enhance: manually stage all changes instead of using --all parameter in git commit

This commit is contained in:
leo 2024-08-15 20:09:38 +08:00
parent 3bcea2a4f0
commit 2ffc1b7178
No known key found for this signature in database
10 changed files with 16 additions and 21 deletions

View file

@ -1282,9 +1282,10 @@ namespace SourceGit.ViewModels
return;
}
var autoStage = AutoStageBeforeCommit;
if (!_useAmend)
{
if (AutoStageBeforeCommit)
if (autoStage)
{
if (_count == 0)
{
@ -1306,26 +1307,28 @@ namespace SourceGit.ViewModels
_repo.Settings.PushCommitMessage(_commitMessage);
_repo.SetWatcherEnabled(false);
var autoStage = AutoStageBeforeCommit;
Task.Run(() =>
{
var succ = new Commands.Commit(_repo.FullPath, _commitMessage, autoStage, _useAmend).Exec();
var succ = true;
if (autoStage && _unstaged.Count > 0)
succ = new Commands.Add(_repo.FullPath).Exec();
if (succ)
succ = new Commands.Commit(_repo.FullPath, _commitMessage, _useAmend).Exec();
Dispatcher.UIThread.Post(() =>
{
if (succ)
{
SelectedStaged = [];
CommitMessage = string.Empty;
UseAmend = false;
if (autoPush)
{
PopupHost.ShowAndStartPopup(new Push(_repo, null));
}
}
_repo.MarkWorkingCopyDirtyManually();
_repo.SetWatcherEnabled(true);
IsCommitting = false;
});
});