From 896276fc4a98599fb50b80a2eb59169eeba05140 Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Wed, 12 Mar 2025 00:53:46 -0700 Subject: [PATCH] Don't clobber the user's upstream settings (cherry-pick #26486) (#26528) Cherry-picked Don't clobber the user's upstream settings (#26486) It's not clobbering time :( Release Notes: - Git Beta: Fixed a bug where our push button would always overwrite the current branch's upstream Co-authored-by: Mikayla Maki --- crates/git_ui/src/git_panel.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 7abe3c5fd9fde6c95878c1201dbaa67e0efa1929..cfcaa5a53689db784c1af6cf97ed1348f7d785f0 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -1918,10 +1918,18 @@ impl GitPanel { }; telemetry::event!("Git Pushed"); let branch = branch.clone(); + let options = if force_push { - PushOptions::Force + Some(PushOptions::Force) } else { - PushOptions::SetUpstream + match branch.upstream { + Some(Upstream { + tracking: UpstreamTracking::Gone, + .. + }) + | None => Some(PushOptions::SetUpstream), + _ => None, + } }; let remote = self.get_current_remote(window, cx); @@ -1951,7 +1959,7 @@ impl GitPanel { repo.push( branch.name.clone(), remote.name.clone(), - Some(options), + options, askpass_delegate, cx, )