git: Fix pull failing when tracking remote with different branch name (#41768)

Closes #31430

Release Notes:

- Fixed git pull failing when tracking remote with different branch name

Here's a before/after comparison when `dev` branch has upstream set to
`origin/main`:


https://github.com/user-attachments/assets/3a47e736-c7b7-4634-8cd1-aca7300c3a73
This commit is contained in:
Mayank Verma
2025-11-06 05:18:08 +00:00
committed by GitHub
parent 930b489d90
commit 0b1d3d78a4
5 changed files with 24 additions and 22 deletions
+6 -7
View File
@@ -2250,14 +2250,13 @@ impl GitPanel {
this.askpass_delegate(format!("git pull {}", remote.name), window, cx)
})?;
let branch_name = branch
.upstream
.is_none()
.then(|| branch.name().to_owned().into());
let pull = repo.update(cx, |repo, cx| {
repo.pull(
branch.name().to_owned().into(),
remote.name.clone(),
rebase,
askpass,
cx,
)
repo.pull(branch_name, remote.name.clone(), rebase, askpass, cx)
})?;
let remote_message = pull.await?;