Merge fcba83c3a6
into b1b60bb7fe
This commit is contained in:
commit
633e6cb33a
2 changed files with 17 additions and 7 deletions
|
@ -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/")
|
||||||
}
|
}
|
||||||
|
|
|
@ -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?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue