mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-22 05:40:43 +08:00
enhance: save commit message to .git/MERGE_MSG while closing repo with in-progress state (#1795)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -567,7 +567,11 @@ namespace SourceGit.ViewModels
|
||||
|
||||
if (!_isWorktree)
|
||||
{
|
||||
_settings.LastCommitMessage = _workingCopy.CommitMessage;
|
||||
if (_workingCopy.InProgressContext != null && !string.IsNullOrEmpty(_workingCopy.CommitMessage))
|
||||
File.WriteAllText(Path.Combine(GitDir, "MERGE_MSG"), _workingCopy.CommitMessage);
|
||||
else
|
||||
_settings.LastCommitMessage = _workingCopy.CommitMessage;
|
||||
|
||||
using var stream = File.Create(Path.Combine(_gitCommonDir, "sourcegit.settings"));
|
||||
JsonSerializer.Serialize(stream, _settings, JsonCodeGen.Default.RepositorySettings);
|
||||
}
|
||||
|
||||
@@ -796,13 +796,8 @@ namespace SourceGit.ViewModels
|
||||
if (LoadCommitMessageFromFile(Path.Combine(_repo.GitDir, "rebase-merge", "message")))
|
||||
break;
|
||||
|
||||
var rebaseProcessingFile = Path.Combine(_repo.GitDir, "rebase-apply", "final-commit");
|
||||
if (File.Exists(rebaseProcessingFile))
|
||||
{
|
||||
var sha = File.ReadAllText(rebaseProcessingFile);
|
||||
if (!string.IsNullOrEmpty(sha))
|
||||
CommitMessage = new Commands.QueryCommitFullMessage(_repo.FullPath, sha).GetResult();
|
||||
}
|
||||
if (_inProgressContext is RebaseInProgress { StoppedAt: { } stopAt })
|
||||
CommitMessage = new Commands.QueryCommitFullMessage(_repo.FullPath, stopAt.SHA).GetResult();
|
||||
} while (false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user