From de75f5010b1024cf549fb6b3e56c429ffcbf1e1d Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 22 Nov 2023 10:29:53 +0800 Subject: [PATCH] optimize: run as stage/unstage all if all changes selected --- src/Views/Widgets/WorkingCopyChanges.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/Widgets/WorkingCopyChanges.xaml.cs b/src/Views/Widgets/WorkingCopyChanges.xaml.cs index 36e8d126..b908602b 100644 --- a/src/Views/Widgets/WorkingCopyChanges.xaml.cs +++ b/src/Views/Widgets/WorkingCopyChanges.xaml.cs @@ -371,7 +371,7 @@ namespace SourceGit.Views.Widgets { private async void DoStage(List files) { IsStaging = true; Models.Watcher.SetEnabled(repo, false); - if (files == null || files.Count == 0) { + if (files == null || files.Count == 0 || files.Count == Changes.Count) { await Task.Run(() => new Commands.Add(repo).Exec()); } else { for (int i = 0; i < files.Count; i += 10) { @@ -709,7 +709,7 @@ namespace SourceGit.Views.Widgets { #region STAGED private async void DoUnstage(List files) { Models.Watcher.SetEnabled(repo, false); - if (files == null || files.Count == 0) { + if (files == null || files.Count == 0 || files.Count == Changes.Count) { await Task.Run(() => new Commands.Reset(repo).Exec()); } else { for (int i = 0; i < files.Count; i += 10) {