diff --git a/src/Git/Repository.cs b/src/Git/Repository.cs index 9f1bd463..c11f3169 100644 --- a/src/Git/Repository.cs +++ b/src/Git/Repository.cs @@ -655,16 +655,25 @@ namespace SourceGit.Git { public void Stage(params string[] files) { isWatcherDisabled = true; - var args = "add"; if (files == null || files.Length == 0) { - args += " ."; + var errs = RunCommand("add .", null); + if (errs != null) App.RaiseError(errs); } else { - args += " --"; - foreach (var file in files) args += $" \"{file}\""; - } + for (int i = 0; i < files.Length; i += 10) { + var args = "add --"; + var maxIdx = i + 10; - var errs = RunCommand(args, null); - if (errs != null) App.RaiseError(errs); + for (int j = i; j < files.Length && j < maxIdx; j++) { + args += $" \"{files[j]}\""; + } + + var errs = RunCommand(args, null); + if (errs != null) { + App.RaiseError(errs); + break; + } + } + } OnWorkingCopyChanged?.Invoke(); isWatcherDisabled = false; @@ -677,14 +686,25 @@ namespace SourceGit.Git { public void Unstage(params string[] files) { isWatcherDisabled = true; - var args = "reset"; - if (files != null && files.Length > 0) { - args += " --"; - foreach (var file in files) args += $" \"{file}\""; - } + if (files == null || files.Length == 0) { + var errs = RunCommand("reset", null); + if (errs != null) App.RaiseError(errs); + } else { + for (int i = 0; i < files.Length; i += 10) { + var args = "reset --"; + var maxIdx = i + 10; - var errs = RunCommand(args, null); - if (errs != null) App.RaiseError(errs); + for (int j = i; j < files.Length && j < maxIdx; j++) { + args += $" \"{files[j]}\""; + } + + var errs = RunCommand(args, null); + if (errs != null) { + App.RaiseError(errs); + break; + } + } + } OnWorkingCopyChanged?.Invoke(); isWatcherDisabled = false; diff --git a/src/Resources/Locales/en_US.xaml b/src/Resources/Locales/en_US.xaml index cdc851ea..09702b2e 100644 --- a/src/Resources/Locales/en_US.xaml +++ b/src/Resources/Locales/en_US.xaml @@ -411,6 +411,9 @@ Revert merge request detected! Press 'Abort' to restore original HEAD Merge request detected! Press 'Abort' to restore original HEAD + WAITING SUBMOUDLE UPDATE COMPLETE... + WAITING STAGE COMPLETE... + Git has NOT been configured.\nPlease to go [Preference] and configure it first. Path[{0}] not exists! Can NOT locate bash.exe. Make sure bash.exe exists under the same folder with git.exe diff --git a/src/Resources/Locales/zh_CN.xaml b/src/Resources/Locales/zh_CN.xaml index bc2f6903..83833b45 100644 --- a/src/Resources/Locales/zh_CN.xaml +++ b/src/Resources/Locales/zh_CN.xaml @@ -411,6 +411,9 @@ 检测到回滚提交冲突! 检测到分支合并冲突! + 等待子模块更新完成... + 等待暂存完成 ... + GIT尚未配置。请打开【偏好设置】配置GIT路径。 路径({0})不存在或不可读取! 无法找到bash.exe,请确保其在git.exe同目录中! diff --git a/src/UI/Dashboard.xaml.cs b/src/UI/Dashboard.xaml.cs index 397e2a3a..6c94cc84 100644 --- a/src/UI/Dashboard.xaml.cs +++ b/src/UI/Dashboard.xaml.cs @@ -991,7 +991,7 @@ namespace SourceGit.UI { } private void UpdateSubmodule(object sender, RoutedEventArgs e) { - Waiting.Show(repo, () => repo.UpdateSubmodule()); + Waiting.Show(repo, "Text.Waiting.UpdateSubmodule", () => repo.UpdateSubmodule()); } private void SubmoduleLostFocus(object sender, RoutedEventArgs e) { diff --git a/src/UI/Waiting.xaml b/src/UI/Waiting.xaml index bf98f70a..dc8db808 100644 --- a/src/UI/Waiting.xaml +++ b/src/UI/Waiting.xaml @@ -5,4 +5,5 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="160" d:DesignWidth="500" Height="200" Width="500"> + diff --git a/src/UI/Waiting.xaml.cs b/src/UI/Waiting.xaml.cs index c606719e..71b415b6 100644 --- a/src/UI/Waiting.xaml.cs +++ b/src/UI/Waiting.xaml.cs @@ -20,11 +20,14 @@ namespace SourceGit.UI { /// Show this dialog. /// /// + /// /// - public static void Show(Git.Repository repo, Action job) { + public static void Show(Git.Repository repo, string tipKey, Action job) { var dialog = new Waiting(); - var popup = repo.GetPopupManager(); + var tip = dialog.FindResource(tipKey) as string; + if (tip != null) dialog.txtTip.Text = tip; + var popup = repo.GetPopupManager(); popup?.Show(dialog); popup?.Lock(); Task.Run(() => { diff --git a/src/UI/WorkingCopy.xaml.cs b/src/UI/WorkingCopy.xaml.cs index 7ff31ba7..e3adff24 100644 --- a/src/UI/WorkingCopy.xaml.cs +++ b/src/UI/WorkingCopy.xaml.cs @@ -336,8 +336,8 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Text("FileCM.Stage"); - stage.Click += async (o, e) => { - await Task.Run(() => Repo.Stage(node.FilePath)); + stage.Click += (o, e) => { + Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(node.FilePath)); e.Handled = true; }; @@ -408,8 +408,8 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Format("FileCM.StageMulti", changes.Count); - stage.Click += async (o, e) => { - await Task.Run(() => Repo.Stage(files.ToArray())); + stage.Click += (o, e) => { + Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray())); e.Handled = true; }; @@ -478,8 +478,8 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Text("FileCM.Stage"); - stage.Click += async (o, e) => { - await Task.Run(() => Repo.Stage(change.Path)); + stage.Click += (o, e) => { + Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(change.Path)); e.Handled = true; }; @@ -551,8 +551,8 @@ namespace SourceGit.UI { var stage = new MenuItem(); stage.Header = App.Format("FileCM.StageMulti", changes.Count); - stage.Click += async (o, e) => { - await Task.Run(() => Repo.Stage(files.ToArray())); + stage.Click += (o, e) => { + Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray())); e.Handled = true; }; @@ -596,7 +596,7 @@ namespace SourceGit.UI { ev.Handled = true; } - private async void Stage(object sender, RoutedEventArgs e) { + private void Stage(object sender, RoutedEventArgs e) { var files = new List(); if (App.Setting.UI.UnstageFileDisplayMode != Preference.FilesDisplayMode.Tree) { @@ -614,11 +614,11 @@ namespace SourceGit.UI { } if (files.Count == 0) return; - await Task.Run(() => Repo.Stage(files.ToArray())); + Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage(files.ToArray())); } - private async void StageAll(object sender, RoutedEventArgs e) { - await Task.Run(() => Repo.Stage()); + private void StageAll(object sender, RoutedEventArgs e) { + Waiting.Show(Repo, "Text.Waiting.Staging", () => Repo.Stage()); } #endregion