feature: allow to reset author when --amend is enabled for committing

This commit is contained in:
leo 2025-05-26 12:28:00 +08:00
parent d3bc85418e
commit 0641a22230
No known key found for this signature in database
8 changed files with 38 additions and 12 deletions

View file

@ -91,6 +91,7 @@ namespace SourceGit.ViewModels
else
{
CommitMessage = string.Empty;
ResetAuthor = false;
}
Staged = GetStagedChanges();
@ -100,6 +101,12 @@ namespace SourceGit.ViewModels
}
}
public bool ResetAuthor
{
get => _resetAuthor;
set => SetProperty(ref _resetAuthor, value);
}
public string Filter
{
get => _filter;
@ -1717,6 +1724,7 @@ namespace SourceGit.ViewModels
_repo.Settings.PushCommitMessage(_commitMessage);
_repo.SetWatcherEnabled(false);
var signOff = _repo.Settings.EnableSignOffForCommit;
var log = _repo.CreateLog("Commit");
Task.Run(() =>
{
@ -1725,7 +1733,7 @@ namespace SourceGit.ViewModels
succ = new Commands.Add(_repo.FullPath, _repo.IncludeUntracked).Use(log).Exec();
if (succ)
succ = new Commands.Commit(_repo.FullPath, _commitMessage, _useAmend, _repo.Settings.EnableSignOffForCommit).Use(log).Run();
succ = new Commands.Commit(_repo.FullPath, _commitMessage, signOff, _useAmend, _resetAuthor).Use(log).Run();
log.Complete();
@ -1785,6 +1793,7 @@ namespace SourceGit.ViewModels
private bool _isUnstaging = false;
private bool _isCommitting = false;
private bool _useAmend = false;
private bool _resetAuthor = false;
private bool _hasRemotes = false;
private List<Models.Change> _cached = [];
private List<Models.Change> _unstaged = [];