1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-11-25 22:32:13 +02:00

Replace MergeOpts struct with MergeVariant enum

- Squash and FastForwardOnly are mutually exclusive, and instead of asserting
  this at runtime, model the API so that they can't be passed together.
- FastForwardOnly is unused, so remove it; however, we are going to need --ff
  and --no-ff in the next commit, so add those instead.
- Instead of putting the enum into the MergeOpts struct, replace the struct by
  the enum. We can reintroduce the struct when we add more arguments, but for
  now it's an unnecessary indirection.
This commit is contained in:
Stefan Haller
2025-10-14 14:57:59 +02:00
parent d334bae0a0
commit 4e0194d8f7
3 changed files with 50 additions and 21 deletions

View File

@@ -426,7 +426,7 @@ func (self *MergeAndRebaseHelper) MergeRefIntoCheckedOutBranch(refName string) e
func (self *MergeAndRebaseHelper) RegularMerge(refName string) func() error {
return func() error {
self.c.LogAction(self.c.Tr.Actions.Merge)
err := self.c.Git().Branch.Merge(refName, git_commands.MergeOpts{})
err := self.c.Git().Branch.Merge(refName, git_commands.MERGE_VARIANT_REGULAR)
return self.CheckMergeOrRebase(err)
}
}
@@ -434,7 +434,7 @@ func (self *MergeAndRebaseHelper) RegularMerge(refName string) func() error {
func (self *MergeAndRebaseHelper) SquashMergeUncommitted(refName string) func() error {
return func() error {
self.c.LogAction(self.c.Tr.Actions.SquashMerge)
err := self.c.Git().Branch.Merge(refName, git_commands.MergeOpts{Squash: true})
err := self.c.Git().Branch.Merge(refName, git_commands.MERGE_VARIANT_SQUASH)
return self.CheckMergeOrRebase(err)
}
}
@@ -442,7 +442,7 @@ func (self *MergeAndRebaseHelper) SquashMergeUncommitted(refName string) func()
func (self *MergeAndRebaseHelper) SquashMergeCommitted(refName, checkedOutBranchName string) func() error {
return func() error {
self.c.LogAction(self.c.Tr.Actions.SquashMerge)
err := self.c.Git().Branch.Merge(refName, git_commands.MergeOpts{Squash: true})
err := self.c.Git().Branch.Merge(refName, git_commands.MERGE_VARIANT_SQUASH)
if err = self.CheckMergeOrRebase(err); err != nil {
return err
}