git: Check push config before falling back to branch remote (#41700)
Closes #26649 Release Notes: - Improved git support for remotes handling. Git will now check pushRemote and pushDefault configurations before falling back to branch remote. --------- Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
This commit is contained in:
co-authored by
Jakub Konka
parent
d877e562ab
commit
87e3d6e014
@@ -2111,7 +2111,7 @@ impl GitPanel {
|
||||
cx.spawn_in(window, async move |_, cx| {
|
||||
let repo = repo?;
|
||||
let remotes = repo
|
||||
.update(cx, |repo, _| repo.get_remotes(None))
|
||||
.update(cx, |repo, _| repo.get_remotes(None, false))
|
||||
.ok()?
|
||||
.await
|
||||
.ok()?
|
||||
@@ -2375,7 +2375,7 @@ impl GitPanel {
|
||||
};
|
||||
telemetry::event!("Git Pulled");
|
||||
let branch = branch.clone();
|
||||
let remote = self.get_remote(false, window, cx);
|
||||
let remote = self.get_remote(false, false, window, cx);
|
||||
cx.spawn_in(window, async move |this, cx| {
|
||||
let remote = match remote.await {
|
||||
Ok(Some(remote)) => remote,
|
||||
@@ -2451,7 +2451,7 @@ impl GitPanel {
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
let remote = self.get_remote(select_remote, window, cx);
|
||||
let remote = self.get_remote(select_remote, true, window, cx);
|
||||
|
||||
cx.spawn_in(window, async move |this, cx| {
|
||||
let remote = match remote.await {
|
||||
@@ -2528,6 +2528,7 @@ impl GitPanel {
|
||||
fn get_remote(
|
||||
&mut self,
|
||||
always_select: bool,
|
||||
is_push: bool,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> impl Future<Output = anyhow::Result<Option<Remote>>> + use<> {
|
||||
@@ -2545,7 +2546,7 @@ impl GitPanel {
|
||||
let current_branch = repo.branch.as_ref().context("No active branch")?;
|
||||
Some(current_branch.name().to_string())
|
||||
};
|
||||
anyhow::Ok(repo.get_remotes(current_branch))
|
||||
anyhow::Ok(repo.get_remotes(current_branch, is_push))
|
||||
})??
|
||||
.await??;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user