git: Fix branch picker creating new branches with refs/head/ prefixed on the branch name (#44206)
The bug was introduced in this recent PR: https://github.com/zed-industries/zed/pull/42819. Since it's still in nightly, there is no need for release notes. I also polished the feature a bit by: - Ensuring branch names are always a single line so the branch picker's uniform list uses the correct element height. - Adding tooltip text for the filter remotes button. - Fixing the create branch from default icon showing up for non-new branch entries. Release Notes: - N/A
This commit is contained in:
@@ -381,11 +381,18 @@ impl GitRepository for FakeGitRepository {
|
||||
Ok(state
|
||||
.branches
|
||||
.iter()
|
||||
.map(|branch_name| Branch {
|
||||
is_head: Some(branch_name) == current_branch.as_ref(),
|
||||
ref_name: branch_name.into(),
|
||||
most_recent_commit: None,
|
||||
upstream: None,
|
||||
.map(|branch_name| {
|
||||
let ref_name = if branch_name.starts_with("refs/") {
|
||||
branch_name.into()
|
||||
} else {
|
||||
format!("refs/heads/{branch_name}").into()
|
||||
};
|
||||
Branch {
|
||||
is_head: Some(branch_name) == current_branch.as_ref(),
|
||||
ref_name,
|
||||
most_recent_commit: None,
|
||||
upstream: None,
|
||||
}
|
||||
})
|
||||
.collect())
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user