Skip to content

Commit 61e9fcc

Browse files
committed
enhance: in-progress state
- `git am` in-progress state requires that `$GIT_DIR/rebase-apply/applying` file exists - Auto remove `$GIT_DIR/rebase-apply/applying` when there are no in-progress states Signed-off-by: leo <longshuang@msn.cn>
1 parent 26e0e9a commit 61e9fcc

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎src/ViewModels/WorkingCopy.cs‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ private void UpdateInProgressState()
801801
InProgressContext = new CherryPickInProgress(_repo);
802802
else if (Directory.Exists(Path.Combine(_repo.GitDir, "rebase-merge")))
803803
InProgressContext = new RebaseInProgress(_repo);
804-
else if (Directory.Exists(Path.Combine(_repo.GitDir, "rebase-apply")))
804+
else if (Directory.Exists(Path.Combine(_repo.GitDir, "rebase-apply")) && File.Exists(Path.Combine(_repo.GitDir, "rebase-apply", "applying")))
805805
InProgressContext = new AmInProgress(_repo);
806806
else if (File.Exists(Path.Combine(_repo.GitDir, "REVERT_HEAD")))
807807
InProgressContext = new RevertInProgress(_repo);
@@ -810,14 +810,19 @@ private void UpdateInProgressState()
810810
else
811811
InProgressContext = null;
812812

813-
if (_inProgressContext != null && _inProgressContext.GetType() == oldType && !string.IsNullOrEmpty(_commitMessage))
813+
if (_inProgressContext == null)
814+
{
815+
if (Directory.Exists(Path.Combine(_repo.GitDir, "rebase-apply")))
816+
Directory.Delete(Path.Combine(_repo.GitDir, "rebase-apply"), true);
817+
818+
if (oldType != null && IsAutoLoadedCommitMessage())
819+
CommitMessage = string.Empty;
820+
814821
return;
822+
}
815823

816-
// The operation that filled the commit message ended outside SourceGit (for example, a
817-
// rebase or merge finished/aborted from the terminal). Drop the stale message unless the
818-
// user has edited it since it was loaded.
819-
if (_inProgressContext == null && oldType != null && IsAutoLoadedCommitMessage())
820-
CommitMessage = string.Empty;
824+
if (_inProgressContext.GetType() == oldType && !string.IsNullOrEmpty(_commitMessage))
825+
return;
821826

822827
if (LoadCommitMessageFromFile(Path.Combine(_repo.GitDir, "MERGE_MSG")))
823828
return;

0 commit comments

Comments
 (0)