Make WorkingTreeState a struct, and add cherry-picking and reverting states

This commit is contained in:
Stefan Haller 2024-06-10 17:54:04 +02:00
parent 8af8f7754b
commit 542525743c
17 changed files with 176 additions and 95 deletions

View file

@ -228,7 +228,7 @@ func (self *PatchCommands) MovePatchIntoIndex(commits []*models.Commit, commitId
}
if err := self.ApplyCustomPatch(true, true); err != nil {
if self.status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING {
if self.status.WorkingTreeState().Rebasing {
_ = self.rebase.AbortRebase()
}
return err
@ -252,7 +252,7 @@ func (self *PatchCommands) MovePatchIntoIndex(commits []*models.Commit, commitId
self.rebase.onSuccessfulContinue = func() error {
// add patches to index
if err := self.ApplyPatch(patch, ApplyPatchOpts{Index: true, ThreeWay: true}); err != nil {
if self.status.WorkingTreeState() == models.WORKING_TREE_STATE_REBASING {
if self.status.WorkingTreeState().Rebasing {
_ = self.rebase.AbortRebase()
}
return err