This commit is contained in:
Kiran_Peraka 2025-08-27 03:15:14 +09:00 committed by GitHub
commit 633e6cb33a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 7 deletions

View file

@ -88,6 +88,12 @@ impl Upstream {
.and_then(|stripped| stripped.split("/").next()) .and_then(|stripped| stripped.split("/").next())
} }
pub fn branch_name(&self) -> Option<&str> {
self.ref_name
.strip_prefix("refs/remotes/")
.and_then(|stripped| stripped.split('/').nth(1))
}
pub fn stripped_ref_name(&self) -> Option<&str> { pub fn stripped_ref_name(&self) -> Option<&str> {
self.ref_name.strip_prefix("refs/remotes/") self.ref_name.strip_prefix("refs/remotes/")
} }

View file

@ -2259,7 +2259,16 @@ impl GitPanel {
return; return;
}; };
telemetry::event!("Git Pulled"); telemetry::event!("Git Pulled");
let branch = branch.clone(); let branch_name: SharedString = if let Some(upstream) = branch.upstream.as_ref() {
if let Some(upstream_branch) = upstream.branch_name() {
SharedString::from(upstream_branch.to_string())
} else {
branch.name().to_owned().into()
}
} else {
branch.name().to_owned().into()
};
let remote = self.get_remote(false, window, cx); let remote = self.get_remote(false, window, cx);
cx.spawn_in(window, async move |this, cx| { cx.spawn_in(window, async move |this, cx| {
let remote = match remote.await { let remote = match remote.await {
@ -2280,12 +2289,7 @@ impl GitPanel {
})?; })?;
let pull = repo.update(cx, |repo, cx| { let pull = repo.update(cx, |repo, cx| {
repo.pull( repo.pull(branch_name.clone(), remote.name.clone(), askpass, cx)
branch.name().to_owned().into(),
remote.name.clone(),
askpass,
cx,
)
})?; })?;
let remote_message = pull.await?; let remote_message = pull.await?;