From 8a38b6afacbcea14c83bbc3951a1f5411a30d6ac Mon Sep 17 00:00:00 2001 From: RevenantX Date: Sat, 27 Jul 2024 12:52:01 +0300 Subject: [PATCH] Add fetch all branches on pull. (acts like fetch+pull) --- src/Models/RepositorySettings.cs | 6 ++++++ src/Resources/Locales/en_US.axaml | 1 + src/ViewModels/Pull.cs | 12 ++++++++++++ src/Views/Pull.axaml | 6 +++++- 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs index 98926500..e0635dd3 100644 --- a/src/Models/RepositorySettings.cs +++ b/src/Models/RepositorySettings.cs @@ -34,6 +34,12 @@ namespace SourceGit.Models set; } = false; + public bool FetchAllBranchesOnPull + { + get; + set; + } = false; + public bool PushAllTags { get; diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index cc09d42f..dd156445 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -403,6 +403,7 @@ Prune worktree information in `$GIT_DIR/worktrees` Pull Branch: + Fetch all branches on pull Into: Local Changes: Discard diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index 2811f306..6c851458 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -58,6 +58,12 @@ namespace SourceGit.ViewModels get => _repo.Settings.PreferRebaseInsteadOfMerge; set => _repo.Settings.PreferRebaseInsteadOfMerge = value; } + + public bool FetchAllBranchesOnPull + { + get => _repo.Settings.FetchAllBranchesOnPull; + set => _repo.Settings.FetchAllBranchesOnPull = value; + } public bool NoTags { @@ -151,6 +157,12 @@ namespace SourceGit.ViewModels } } + if (FetchAllBranchesOnPull) + { + SetProgressDescription($"Fetching remote: {_selectedRemote.Name}..."); + new Commands.Fetch(_repo.FullPath, _selectedRemote.Name, false, NoTags, SetProgressDescription).Exec(); + } + SetProgressDescription($"Pull {_selectedRemote.Name}/{_selectedBranch.Name}..."); var rs = new Commands.Pull(_repo.FullPath, _selectedRemote.Name, _selectedBranch.Name, UseRebase, NoTags, SetProgressDescription).Exec(); if (rs && needPopStash) diff --git a/src/Views/Pull.axaml b/src/Views/Pull.axaml index fe1174a9..ff9b9c5b 100644 --- a/src/Views/Pull.axaml +++ b/src/Views/Pull.axaml @@ -12,7 +12,7 @@ - + + +