File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff line change @@ -810,25 +810,23 @@ private void UpdateInProgressState()
810810 else
811811 InProgressContext = null ;
812812
813- var mergeMsg = Path . Combine ( _repo . GitDir , "MERGE_MSG" ) ;
814-
815813 if ( _inProgressContext == null )
816814 {
817815 if ( Directory . Exists ( Path . Combine ( _repo . GitDir , "rebase-apply" ) ) )
818816 Directory . Delete ( Path . Combine ( _repo . GitDir , "rebase-apply" ) , true ) ;
819817
820- // MERGE_MSG may exist without an in-progress marker (e.g. after
821- // `git cherry-pick -n` or `git revert -n`), so try loading it first.
822- if ( ! LoadCommitMessageFromFile ( mergeMsg ) && oldType != null && IsAutoLoadedCommitMessage ( ) )
818+ if ( oldType != null && IsAutoLoadedCommitMessage ( ) )
823819 CommitMessage = string . Empty ;
820+ else if ( string . IsNullOrEmpty ( _commitMessage ) )
821+ LoadCommitMessageFromFile ( Path . Combine ( _repo . GitDir , "MERGE_MSG" ) ) ;
824822
825823 return ;
826824 }
827825
828826 if ( _inProgressContext . GetType ( ) == oldType && ! string . IsNullOrEmpty ( _commitMessage ) )
829827 return ;
830828
831- if ( LoadCommitMessageFromFile ( mergeMsg ) )
829+ if ( LoadCommitMessageFromFile ( Path . Combine ( _repo . GitDir , "MERGE_MSG" ) ) )
832830 return ;
833831
834832 if ( _inProgressContext is RebaseInProgress rebasing )
You can’t perform that action at this time.
0 commit comments