From b9d7f908c91ddbf947cd42206abd9f6842f5033d Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 22 Oct 2024 16:53:48 +0800 Subject: [PATCH] refactor: do NOT use the `--prune` parameter for `git fetch` command (#590) --- src/Commands/Fetch.cs | 5 +---- src/Resources/Locales/de_DE.axaml | 1 - src/Resources/Locales/en_US.axaml | 1 - src/Resources/Locales/fr_FR.axaml | 1 - src/Resources/Locales/pt_BR.axaml | 1 - src/Resources/Locales/ru_RU.axaml | 1 - src/Resources/Locales/zh_CN.axaml | 1 - src/Resources/Locales/zh_TW.axaml | 1 - src/ViewModels/AddRemote.cs | 2 +- src/ViewModels/Fetch.cs | 10 ++-------- src/ViewModels/Pull.cs | 2 +- src/ViewModels/Repository.cs | 2 +- src/Views/Fetch.axaml | 6 +----- 13 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/Commands/Fetch.cs b/src/Commands/Fetch.cs index 17f08609..ea4e54bf 100644 --- a/src/Commands/Fetch.cs +++ b/src/Commands/Fetch.cs @@ -4,7 +4,7 @@ namespace SourceGit.Commands { public class Fetch : Command { - public Fetch(string repo, string remote, bool prune, bool noTags, Action outputHandler) + public Fetch(string repo, string remote, bool noTags, Action outputHandler) { _outputHandler = outputHandler; WorkingDirectory = repo; @@ -13,9 +13,6 @@ namespace SourceGit.Commands SSHKey = new Config(repo).Get($"remote.{remote}.sshkey"); Args = "fetch --progress --verbose "; - if (prune) - Args += "--prune "; - if (noTags) Args += "--no-tags "; else diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index f5a6c91c..a3efe0c2 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -243,7 +243,6 @@ Fetch Alle Remotes fetchen Ohne Tags fetchen - Alle verwaisten Branches entfernen Remote: Remote-Änderungen fetchen Als unverändert annehmen diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 9c3c7a9a..dfdcc6b0 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -247,7 +247,6 @@ Fetch Fetch all remotes Fetch without tags - Prune remote dead branches Remote: Fetch Remote Changes Assume unchanged diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 631750dd..14512b2f 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -229,7 +229,6 @@ Fetch Fetch toutes les branches distantes Fetch sans les tags - Élaguer les branches mortes distantes Remote : Récupérer les changements distants Présumer inchangé diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 362e81f1..d00c37c1 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -225,7 +225,6 @@ Buscar Buscar todos os remotos Buscar sem tags - Prune remotos mortos Remoto: Buscar Alterações Remotas Assumir não alterado diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index e331ac31..cfb86496 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -251,7 +251,6 @@ Извлечь Извлечь все внешние хранилища Извлечь без меток - Удалить внешние мёртвые ветки Внешнее хранилище: Извлечь внешние изменения Допустить без изменений diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index d17aab23..c09fa75b 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -250,7 +250,6 @@ 拉取(fetch) 拉取所有的远程仓库 不拉取远程标签 - 自动清理远程已删除分支 远程仓库 : 拉取远程仓库内容 不跟踪此文件的更改 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 715f0b95..2c3367a7 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -250,7 +250,6 @@ 提取 (fetch) 提取所有的遠端存放庫 不提取遠端標籤 - 自動清理遠端已刪除分支 遠端存放庫: 提取遠端存放庫內容 不追蹤此檔案的變更 diff --git a/src/ViewModels/AddRemote.cs b/src/ViewModels/AddRemote.cs index f2e71f4c..d2a7729a 100644 --- a/src/ViewModels/AddRemote.cs +++ b/src/ViewModels/AddRemote.cs @@ -100,7 +100,7 @@ namespace SourceGit.ViewModels { SetProgressDescription("Fetching from added remote ..."); new Commands.Config(_repo.FullPath).Set($"remote.{_name}.sshkey", _useSSH ? SSHKey : null); - new Commands.Fetch(_repo.FullPath, _name, true, false, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, _name, false, SetProgressDescription).Exec(); } CallUIThread(() => { diff --git a/src/ViewModels/Fetch.cs b/src/ViewModels/Fetch.cs index e00669bf..3fe92a5f 100644 --- a/src/ViewModels/Fetch.cs +++ b/src/ViewModels/Fetch.cs @@ -22,12 +22,6 @@ namespace SourceGit.ViewModels set; } - public bool Prune - { - get; - set; - } = true; - public bool NoTags { get => _repo.Settings.FetchWithoutTags; @@ -53,13 +47,13 @@ namespace SourceGit.ViewModels foreach (var remote in _repo.Remotes) { SetProgressDescription($"Fetching remote: {remote.Name}"); - new Commands.Fetch(_repo.FullPath, remote.Name, Prune, NoTags, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, remote.Name, NoTags, SetProgressDescription).Exec(); } } else { SetProgressDescription($"Fetching remote: {SelectedRemote.Name}"); - new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, Prune, NoTags, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, NoTags, SetProgressDescription).Exec(); } CallUIThread(() => diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index b37e8817..fdaad920 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -147,7 +147,7 @@ namespace SourceGit.ViewModels if (FetchAllBranches) { SetProgressDescription($"Fetching remote: {_selectedRemote.Name}..."); - rs = new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, false, NoTags, SetProgressDescription).Exec(); + rs = new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, NoTags, SetProgressDescription).Exec(); if (!rs) return false; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 8fc56a38..8f6e1f88 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -2114,7 +2114,7 @@ namespace SourceGit.ViewModels IsAutoFetching = true; Dispatcher.UIThread.Invoke(() => OnPropertyChanged(nameof(IsAutoFetching))); - new Commands.Fetch(_fullpath, "--all", true, false, null) { RaiseError = false }.Exec(); + new Commands.Fetch(_fullpath, "--all", false, null) { RaiseError = false }.Exec(); _lastFetchTime = DateTime.Now; IsAutoFetching = false; Dispatcher.UIThread.Invoke(() => OnPropertyChanged(nameof(IsAutoFetching))); diff --git a/src/Views/Fetch.axaml b/src/Views/Fetch.axaml index e6821c31..a9c2fd90 100644 --- a/src/Views/Fetch.axaml +++ b/src/Views/Fetch.axaml @@ -11,7 +11,7 @@ - + - -