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
This commit is contained in:
Mikayla Maki 2025-03-11 15:02:22 -07:00 committed by GitHub
parent 7019aca59d
commit fd7ab20ea4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1706,10 +1706,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);
@ -1739,7 +1747,7 @@ impl GitPanel {
repo.push(
branch.name.clone(),
remote.name.clone(),
Some(options),
options,
askpass_delegate,
cx,
)