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: Prefer main over master when detecting default branch (#57398)

Henrique Ferreiro950fd46d5c96
diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rs
index 88db950669c..445178e8a6f 100644
--- a/crates/git/src/repository.rs
+++ b/crates/git/src/repository.rs
@@ -2904,6 +2904,10 @@ impl GitRepository for RealGitRepository {
}
}
+ if git.run(&["rev-parse", "main"]).await.is_ok() {
+ return Ok(Some("main".into()));
+ }
+
if git.run(&["rev-parse", "master"]).await.is_ok() {
return Ok(Some("master".into()));
}