Skip to content

Commit 4f18ef1

Browse files
fix: commit message not loaded after cherry-pick/revert with --no-commit (#2858)
* fix: commit message not loaded after cherry-pick/revert with `--no-commit` * code_review: auto-load commit message --------- Co-authored-by: leo <longshuang@msn.cn>
1 parent 56dd611 commit 4f18ef1

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/ViewModels/Repository.cs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,10 @@ public void Close()
481481
{
482482
var commitMessage = _workingCopy.CommitMessage;
483483
if (!string.IsNullOrEmpty(commitMessage) && _workingCopy.InProgressContext != null)
484+
{
484485
File.WriteAllText(Path.Combine(GitDir, "MERGE_MSG"), commitMessage);
486+
commitMessage = string.Empty; // Clears this from ui-state, since it is already saved in MERGE_MSG file.
487+
}
485488

486489
_uiStates.LastCommitMessage = commitMessage;
487490
_uiStates.Save();

‎src/ViewModels/WorkingCopy.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,8 @@ private void UpdateInProgressState()
817817

818818
if (oldType != null && IsAutoLoadedCommitMessage())
819819
CommitMessage = string.Empty;
820+
else if (string.IsNullOrEmpty(_commitMessage))
821+
LoadCommitMessageFromFile(Path.Combine(_repo.GitDir, "MERGE_MSG"));
820822

821823
return;
822824
}

0 commit comments

Comments
 (0)