Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

git_ui: Replace spaces with hyphens in new branch names (#27873)

5brianb7c5540075bb
diff --git a/crates/git_ui/src/branch_picker.rs b/crates/git_ui/src/branch_picker.rs
index aaa69373636..5f51f8e2db8 100644
--- a/crates/git_ui/src/branch_picker.rs
+++ b/crates/git_ui/src/branch_picker.rs
@@ -221,6 +221,7 @@ impl BranchListDelegate {
let Some(repo) = self.repo.clone() else {
return;
};
+ let new_branch_name = new_branch_name.to_string().replace(' ', "-");
cx.spawn(async move |_, cx| {
repo.update(cx, |repo, _| {
repo.create_branch(new_branch_name.to_string())
@@ -325,6 +326,7 @@ impl PickerDelegate for BranchListDelegate {
.first()
.is_some_and(|entry| entry.branch.name() == query)
{
+ let query = query.replace(' ', "-");
matches.push(BranchEntry {
branch: Branch {
ref_name: format!("refs/heads/{query}").into(),