Add bisect menu entry that lets you choose bisect terms

This can be useful if you want to find the commit that fixed a bug (you'd use
"broken/fixed" instead of "good/bad" in this case), or if you want to find the
commit that brought a big performance improvement (use "slow/fast"). It's pretty
mind-bending to have to use "good/bad" in these cases, and swap their meanings
in your head.

Thankfully, lazygit already had support for using custom terms during the bisect
(for the case that a bisect was started on the command-line, I suppose), so all
that's needed is adding a way to specify them in lazygit.
This commit is contained in:
Stefan Haller 2023-07-27 14:15:56 +02:00
parent 9b7f978e3e
commit f30e09856c
5 changed files with 110 additions and 0 deletions

View file

@ -153,6 +153,28 @@ func (self *BisectController) openStartBisectMenu(info *git_commands.BisectInfo,
},
Key: 'g',
},
{
Label: self.c.Tr.Bisect.ChooseTerms,
OnPress: func() error {
return self.c.Prompt(types.PromptOpts{
Title: self.c.Tr.Bisect.OldTermPrompt,
HandleConfirm: func(oldTerm string) error {
return self.c.Prompt(types.PromptOpts{
Title: self.c.Tr.Bisect.NewTermPrompt,
HandleConfirm: func(newTerm string) error {
self.c.LogAction(self.c.Tr.Actions.StartBisect)
if err := self.c.Git().Bisect.StartWithTerms(oldTerm, newTerm); err != nil {
return self.c.Error(err)
}
return self.c.Helpers().Bisect.PostBisectCommandRefresh()
},
})
},
})
},
Key: 't',
},
},
})
}