mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
feature: add an option to enable -a,--all in commit command (#244)
This commit is contained in:
@@ -64,6 +64,12 @@ namespace SourceGit.ViewModels
|
||||
set;
|
||||
} = true;
|
||||
|
||||
public bool AutoStageBeforeCommit
|
||||
{
|
||||
get;
|
||||
set;
|
||||
} = false;
|
||||
|
||||
public AvaloniaList<string> Filters
|
||||
{
|
||||
get;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace SourceGit.ViewModels
|
||||
|
||||
return Task.Run(() =>
|
||||
{
|
||||
var succ = new Commands.Commit(_repo.FullPath, _message, true, true).Exec();
|
||||
var succ = new Commands.Commit(_repo.FullPath, _message, false, true, true).Exec();
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return succ;
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace SourceGit.ViewModels
|
||||
{
|
||||
var succ = new Commands.Reset(_repo.FullPath, Parent.SHA, "--soft").Exec();
|
||||
if (succ)
|
||||
succ = new Commands.Commit(_repo.FullPath, _message, true).Exec();
|
||||
succ = new Commands.Commit(_repo.FullPath, _message, false, true).Exec();
|
||||
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
||||
return succ;
|
||||
});
|
||||
|
||||
@@ -77,6 +77,12 @@ namespace SourceGit.ViewModels
|
||||
private set => SetProperty(ref _isCommitting, value);
|
||||
}
|
||||
|
||||
public bool AutoStageBeforeCommit
|
||||
{
|
||||
get => _repo.Settings.AutoStageBeforeCommit;
|
||||
set => _repo.Settings.AutoStageBeforeCommit = value;
|
||||
}
|
||||
|
||||
public bool UseAmend
|
||||
{
|
||||
get => _useAmend;
|
||||
@@ -1216,7 +1222,13 @@ namespace SourceGit.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
if (_staged.Count == 0)
|
||||
if (_count == 0)
|
||||
{
|
||||
App.RaiseException(_repo.FullPath, "No files added to commit!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AutoStageBeforeCommit && _staged.Count == 0)
|
||||
{
|
||||
App.RaiseException(_repo.FullPath, "No files added to commit!");
|
||||
return;
|
||||
@@ -1234,9 +1246,10 @@ namespace SourceGit.ViewModels
|
||||
IsCommitting = true;
|
||||
_repo.SetWatcherEnabled(false);
|
||||
|
||||
var autoStage = AutoStageBeforeCommit;
|
||||
Task.Run(() =>
|
||||
{
|
||||
var succ = new Commands.Commit(_repo.FullPath, _commitMessage, _useAmend).Exec();
|
||||
var succ = new Commands.Commit(_repo.FullPath, _commitMessage, autoStage, _useAmend).Exec();
|
||||
Dispatcher.UIThread.Post(() =>
|
||||
{
|
||||
if (succ)
|
||||
|
||||
Reference in New Issue
Block a user