git: Don't filter local upstreams from branch picker (#30557)
Release Notes: - Fixed local git branches being excluded from the branch selector when they were set as the upstream of another local branch.
This commit is contained in:
parent
571c5e7407
commit
42dd511fc2
2 changed files with 11 additions and 4 deletions
|
@ -78,6 +78,10 @@ pub struct Upstream {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Upstream {
|
impl Upstream {
|
||||||
|
pub fn is_remote(&self) -> bool {
|
||||||
|
self.remote_name().is_some()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn remote_name(&self) -> Option<&str> {
|
pub fn remote_name(&self) -> Option<&str> {
|
||||||
self.ref_name
|
self.ref_name
|
||||||
.strip_prefix("refs/remotes/")
|
.strip_prefix("refs/remotes/")
|
||||||
|
|
|
@ -98,15 +98,18 @@ impl BranchList {
|
||||||
|
|
||||||
let all_branches = cx
|
let all_branches = cx
|
||||||
.background_spawn(async move {
|
.background_spawn(async move {
|
||||||
let upstreams: HashSet<_> = all_branches
|
let remote_upstreams: HashSet<_> = all_branches
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|branch| {
|
.filter_map(|branch| {
|
||||||
let upstream = branch.upstream.as_ref()?;
|
branch
|
||||||
Some(upstream.ref_name.clone())
|
.upstream
|
||||||
|
.as_ref()
|
||||||
|
.filter(|upstream| upstream.is_remote())
|
||||||
|
.map(|upstream| upstream.ref_name.clone())
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
all_branches.retain(|branch| !upstreams.contains(&branch.ref_name));
|
all_branches.retain(|branch| !remote_upstreams.contains(&branch.ref_name));
|
||||||
|
|
||||||
all_branches.sort_by_key(|branch| {
|
all_branches.sort_by_key(|branch| {
|
||||||
branch
|
branch
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue