Skip to content

Commit b83b917

Browse files
committed
Main branch default
1 parent c1f540b commit b83b917

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/utils/vcs.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,14 @@ fn git_initialize_repo() -> TempDir {
899899
.wait()
900900
.expect("Failed to wait on `git init`.");
901901

902+
Command::new("git")
903+
.args(["branch", "-M", "main"])
904+
.current_dir(&dir)
905+
.spawn()
906+
.expect("Failed to execute `git branch`.")
907+
.wait()
908+
.expect("Failed to wait on `git branch`.");
909+
902910
Command::new("git")
903911
.args(["config", "--local", "user.name", "test"])
904912
.current_dir(&dir)
@@ -1224,7 +1232,7 @@ fn test_git_repo_head_ref() {
12241232

12251233
// Test on a branch (should succeed)
12261234
let head_ref = git_repo_head_ref(&repo).expect("Should get branch reference");
1227-
assert_eq!(head_ref, "master");
1235+
assert_eq!(head_ref, "main");
12281236

12291237
// Test in detached HEAD state (should fail)
12301238
let head_commit = repo.head().unwrap().target().unwrap();

0 commit comments

Comments
 (0)