summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-04-06 06:46:48 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-04-29 07:28:33 +0200
commit5645a662de36bd742c36f26b34b9e74510ba54eb (patch)
tree489d2d82b8fc87628da6efd0362f84cbb931c0a9 /pkg/commands
parenta41218551da19b4fb987c5090665692d24852d03 (diff)
Use --rebase-merges for interactive rebase
At the moment it doesn't make a big difference, because the vast majority of callers create a list of todos themselves to completely replace what git came up with. We're changing this in the following commits though, and then it's helpful to preserve merges.
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_commands/rebase.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/pkg/commands/git_commands/rebase.go b/pkg/commands/git_commands/rebase.go
index 5828ffbaa..b34f8886a 100644
--- a/pkg/commands/git_commands/rebase.go
+++ b/pkg/commands/git_commands/rebase.go
@@ -173,7 +173,12 @@ func (self *RebaseCommands) PrepareInteractiveRebaseCommand(opts PrepareInteract
debug = "TRUE"
}
- cmdStr := fmt.Sprintf("git rebase --interactive --autostash --keep-empty --empty=keep --no-autosquash %s", opts.baseShaOrRoot)
+ rebaseMergesArg := " --rebase-merges"
+ if self.version.IsOlderThan(2, 22, 0) {
+ rebaseMergesArg = ""
+ }
+ cmdStr := fmt.Sprintf("git rebase --interactive --autostash --keep-empty --empty=keep --no-autosquash%s %s",
+ rebaseMergesArg, opts.baseShaOrRoot)
self.Log.WithField("command", cmdStr).Debug("RunCommand")
cmdObj := self.cmd.New(cmdStr)