diff --git a/src/Commands/Fetch.cs b/src/Commands/Fetch.cs index d65fee4e..ca1d83d6 100644 --- a/src/Commands/Fetch.cs +++ b/src/Commands/Fetch.cs @@ -7,7 +7,7 @@ namespace SourceGit.Commands { public class Fetch : Command { - public Fetch(string repo, string remote, bool prune, Action outputHandler) + public Fetch(string repo, string remote, bool prune, bool noTags, Action outputHandler) { _outputHandler = outputHandler; WorkingDirectory = repo; @@ -24,9 +24,15 @@ namespace SourceGit.Commands Args = "-c credential.helper=manager "; } - Args += "fetch --force --progress --verbose "; + Args += "fetch --progress --verbose "; if (prune) Args += "--prune "; + + if (noTags) + Args += "--no-tags "; + else + Args += "--force "; + Args += remote; AutoFetch.MarkFetched(repo); @@ -132,7 +138,7 @@ namespace SourceGit.Commands { var job = new Job { - Cmd = new Fetch(repo, "--all", true, null) { RaiseError = false }, + Cmd = new Fetch(repo, "--all", true, false, null) { RaiseError = false }, NextRunTimepoint = DateTime.Now.AddMinutes(Convert.ToDouble(Interval)), }; diff --git a/src/Commands/Pull.cs b/src/Commands/Pull.cs index d4f15dda..43418825 100644 --- a/src/Commands/Pull.cs +++ b/src/Commands/Pull.cs @@ -4,7 +4,7 @@ namespace SourceGit.Commands { public class Pull : Command { - public Pull(string repo, string remote, string branch, bool useRebase, Action outputHandler) + public Pull(string repo, string remote, string branch, bool useRebase, bool noTags, Action outputHandler) { _outputHandler = outputHandler; WorkingDirectory = repo; @@ -24,6 +24,9 @@ namespace SourceGit.Commands Args += "pull --verbose --progress --tags "; if (useRebase) Args += "--rebase "; + if (noTags) + Args += "--no-tags "; + Args += $"{remote} {branch}"; } diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 0586ee99..d3d41a8e 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -200,6 +200,7 @@ Fast-Forward (without checkout) Fetch Fetch all remotes + Fetch without tags Prune remote dead branches Remote: Fetch Remote Changes @@ -386,6 +387,7 @@ Discard Do Nothing Stash & Reapply + Fetch without tags Remote: Pull (Fetch & Merge) Use rebase instead of merge diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 3b6bfb9d..80d4c3b9 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -203,6 +203,7 @@ 快进(fast-forward,无需checkout) 拉取(fetch) 拉取所有的远程仓库 + 不拉取远程标签 自动清理远程已删除分支 远程仓库 : 拉取远程仓库内容 @@ -389,6 +390,7 @@ 丢弃更改 不做处理 贮藏并自动恢复 + 不拉取远程标签 远程 : 拉回(拉取并合并) 使用变基方式合并分支 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index 5563a21a..b37b681f 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -203,6 +203,7 @@ 快進(fast-forward,無需checkout) 拉取(fetch) 拉取所有的遠端倉庫 + 不拉取遠端標籤 自動清理遠端已刪除分支 遠端倉庫 : 拉取遠端倉庫內容 @@ -389,6 +390,7 @@ 丟棄更改 不做處理 儲藏並自動恢復 + 不拉取遠端標籤 遠端 : 拉回(拉取併合並) 使用變基方式合併分支 diff --git a/src/ViewModels/AddRemote.cs b/src/ViewModels/AddRemote.cs index 296ddfdb..104a4ed6 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, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, _name, true, false, SetProgressDescription).Exec(); } CallUIThread(() => { diff --git a/src/ViewModels/Fetch.cs b/src/ViewModels/Fetch.cs index 43ad49dc..3b33bbf2 100644 --- a/src/ViewModels/Fetch.cs +++ b/src/ViewModels/Fetch.cs @@ -26,14 +26,19 @@ namespace SourceGit.ViewModels { get; set; - } + } = true; + + public bool NoTags + { + get; + set; + } = false; public Fetch(Repository repo, Models.Remote preferedRemote = null) { _repo = repo; _fetchAllRemotes = preferedRemote == null; SelectedRemote = preferedRemote != null ? preferedRemote : _repo.Remotes[0]; - Prune = true; View = new Views.Fetch() { DataContext = this }; } @@ -47,13 +52,13 @@ namespace SourceGit.ViewModels foreach (var remote in _repo.Remotes) { SetProgressDescription($"Fetching remote: {remote.Name}"); - new Commands.Fetch(_repo.FullPath, remote.Name, Prune, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, remote.Name, Prune, NoTags, SetProgressDescription).Exec(); } } else { SetProgressDescription($"Fetching remote: {SelectedRemote.Name}"); - new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, Prune, SetProgressDescription).Exec(); + new Commands.Fetch(_repo.FullPath, SelectedRemote.Name, Prune, NoTags, SetProgressDescription).Exec(); } CallUIThread(() => _repo.SetWatcherEnabled(true)); diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index 5a62f5b3..c210017f 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -59,6 +59,12 @@ namespace SourceGit.ViewModels set => _repo.Settings.PreferRebaseInsteadOfMerge = value; } + public bool NoTags + { + get; + set; + } = false; + public Pull(Repository repo, Models.Branch specifiedRemoteBranch) { _repo = repo; @@ -145,7 +151,7 @@ namespace SourceGit.ViewModels } SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}..."); - var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, SetProgressDescription).Exec(); + var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec(); if (rs && needPopStash) { SetProgressDescription("Re-apply local changes..."); diff --git a/src/Views/Fetch.axaml b/src/Views/Fetch.axaml index aaf9bec6..fbcf094b 100644 --- a/src/Views/Fetch.axaml +++ b/src/Views/Fetch.axaml @@ -12,7 +12,7 @@ - + + + diff --git a/src/Views/Pull.axaml b/src/Views/Pull.axaml index d2d1bebb..23d86e1e 100644 --- a/src/Views/Pull.axaml +++ b/src/Views/Pull.axaml @@ -13,7 +13,7 @@ - + + +