From 1ec5cc416d11d5e0f07f180748133932dc288c15 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 13 Sep 2024 17:27:56 +0800 Subject: [PATCH] enhance: leave remote branch to empty when the local branch tracks no branch in the remote while pulling changes (#469) --- src/ViewModels/Pull.cs | 2 +- src/ViewModels/Repository.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ViewModels/Pull.cs b/src/ViewModels/Pull.cs index 152cbb9e..75c0f47a 100644 --- a/src/ViewModels/Pull.cs +++ b/src/ViewModels/Pull.cs @@ -210,7 +210,7 @@ namespace SourceGit.ViewModels } if (!autoSelectedBranch) - SelectedBranch = branches.Count > 0 ? branches[0] : null; + SelectedBranch = null; } private readonly Repository _repo = null; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 4f550ddd..42d26f94 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -490,10 +490,11 @@ namespace SourceGit.ViewModels return; } - if (autoStart) - PopupHost.ShowAndStartPopup(new Pull(this, null)); + var pull = new Pull(this, null); + if (autoStart && pull.SelectedBranch != null) + PopupHost.ShowAndStartPopup(pull); else - PopupHost.ShowPopup(new Pull(this, null)); + PopupHost.ShowPopup(pull); } public void Push(bool autoStart)