mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-28 16:02:01 +03:00
Make WorkingTreeState a struct, and add cherry-picking and reverting states
This commit is contained in:
@ -50,7 +50,7 @@ func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error {
|
||||
{option: REBASE_OPTION_ABORT, key: 'a'},
|
||||
}
|
||||
|
||||
if self.c.Git().Status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING {
|
||||
if self.c.Git().Status.WorkingTreeState().CanSkip() {
|
||||
options = append(options, optionAndKey{
|
||||
option: REBASE_OPTION_SKIP, key: 's',
|
||||
})
|
||||
@ -77,12 +77,13 @@ func (self *MergeAndRebaseHelper) ContinueRebase() error {
|
||||
func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error {
|
||||
status := self.c.Git().Status.WorkingTreeState()
|
||||
|
||||
if status != models.WORKING_TREE_STATE_MERGING && status != models.WORKING_TREE_STATE_REBASING {
|
||||
if status.None() {
|
||||
return errors.New(self.c.Tr.NotMergingOrRebasing)
|
||||
}
|
||||
|
||||
self.c.LogAction(fmt.Sprintf("Merge/Rebase: %s", command))
|
||||
if status == models.WORKING_TREE_STATE_REBASING {
|
||||
effectiveStatus := status.Effective()
|
||||
if effectiveStatus == models.WORKING_TREE_STATE_REBASING {
|
||||
todoFile, err := os.ReadFile(
|
||||
filepath.Join(self.c.Git().RepoPaths.WorktreeGitDirPath(), "rebase-merge/git-rebase-todo"),
|
||||
)
|
||||
@ -101,10 +102,10 @@ func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error {
|
||||
// we should end up with a command like 'git merge --continue'
|
||||
|
||||
// it's impossible for a rebase to require a commit so we'll use a subprocess only if it's a merge
|
||||
needsSubprocess := (status == models.WORKING_TREE_STATE_MERGING && command != REBASE_OPTION_ABORT && self.c.UserConfig().Git.Merging.ManualCommit) ||
|
||||
needsSubprocess := (effectiveStatus == models.WORKING_TREE_STATE_MERGING && command != REBASE_OPTION_ABORT && self.c.UserConfig().Git.Merging.ManualCommit) ||
|
||||
// but we'll also use a subprocess if we have exec todos; those are likely to be lengthy build
|
||||
// tasks whose output the user will want to see in the terminal
|
||||
(status == models.WORKING_TREE_STATE_REBASING && command != REBASE_OPTION_ABORT && self.hasExecTodos())
|
||||
(effectiveStatus == models.WORKING_TREE_STATE_REBASING && command != REBASE_OPTION_ABORT && self.hasExecTodos())
|
||||
|
||||
if needsSubprocess {
|
||||
// TODO: see if we should be calling more of the code from self.Git.Rebase.GenericMergeOrRebaseAction
|
||||
|
Reference in New Issue
Block a user