summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-04-05 09:33:11 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-04-15 08:36:03 +0200
commit227b0b781cb4aab2ae613a66f2e73467670ae208 (patch)
treefcde1490ce4a41f068940f575d6a3e44f25a5425 /pkg/commands
parent740474c10c7d2038a33f9861573a4a85213c2270 (diff)
Show update-ref commands in rebase todo list
This is useful when working with stacked branches, because you can now move "pick" entries across an update-ref command and you can tell exactly which branch the commit will end up in. It's also useful to spot situations where the --update-refs option didn't work as desired. For example, if you duplicate a branch and want to rebase only one of the branches but not the other (maybe for testing); if you have rebase.updateRefs=true in your git config, then rebasing one branch will move the other branch along. To solve this we'll have to introduce a way to delete the update-ref entry (maybe by hitting backspace?); this is out of scope for this PR, so for now users will have to type "git rebase --edit-todo" into the custom command prompt to sort this out. We will also have to prevent users from trying to turn update-ref commands into other commands like "pick" or "drop"; we'll do this later in this branch.
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_commands/commit_loader.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/commands/git_commands/commit_loader.go b/pkg/commands/git_commands/commit_loader.go
index 6e409d717..bce16de15 100644
--- a/pkg/commands/git_commands/commit_loader.go
+++ b/pkg/commands/git_commands/commit_loader.go
@@ -311,7 +311,9 @@ func (self *CommitLoader) getInteractiveRebasingCommits() ([]*models.Commit, err
}
for _, t := range todos {
- if t.Commit == "" {
+ if t.Command == todo.UpdateRef {
+ t.Msg = strings.TrimPrefix(t.Ref, "refs/heads/")
+ } else if t.Commit == "" {
// Command does not have a commit associated, skip
continue
}