Release Notes: - Fixed local git branches being excluded from the branch selector when they were set as the upstream of another local branch.
Unified · Split
| @@ -78,6 +78,10 @@ pub struct Upstream { · 77 unmodified lines | |||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | impl Upstream { | 80 | impl Upstream { |
| 81 | pub fn is_remote(&self) -> bool { | ||
| 82 | self.remote_name().is_some() | ||
| 83 | } | ||
| 84 | |||
| 81 | pub fn remote_name(&self) -> Option<&str> { | 85 | pub fn remote_name(&self) -> Option<&str> { |
| 82 | self.ref_name | 86 | self.ref_name |
| 83 | .strip_prefix("refs/remotes/") | 87 | .strip_prefix("refs/remotes/") |
| @@ -98,15 +98,18 @@ impl BranchList { · 97 unmodified lines | |||
| 98 | 98 | ||
| 99 | let all_branches = cx | 99 | let all_branches = cx |
| 100 | .background_spawn(async move { | 100 | .background_spawn(async move { |
| 101 | let upstreams: HashSet<_> = all_branches | 101 | let remote_upstreams: HashSet<_> = all_branches |
| 102 | .iter() | 102 | .iter() |
| 103 | .filter_map(|branch| { | 103 | .filter_map(|branch| { |
| 104 | let upstream = branch.upstream.as_ref()?; | 104 | branch |
| 105 | Some(upstream.ref_name.clone()) | 105 | .upstream |
| 106 | .as_ref() | ||
| 107 | .filter(|upstream| upstream.is_remote()) | ||
| 108 | .map(|upstream| upstream.ref_name.clone()) | ||
| 106 | }) | 109 | }) |
| 107 | .collect(); | 110 | .collect(); |
| 108 | 111 | ||
| 109 | all_branches.retain(|branch| !upstreams.contains(&branch.ref_name)); | 112 | all_branches.retain(|branch| !remote_upstreams.contains(&branch.ref_name)); |
| 110 | 113 | ||
| 111 | all_branches.sort_by_key(|branch| { | 114 | all_branches.sort_by_key(|branch| { |
| 112 | branch | 115 | branch |