Skip to content

Commit ff976ed

Browse files
committed
tests: default helper repos to main
1 parent 082f5e0 commit ff976ed

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/commands/create.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@ use predicates::prelude::*;
55
use tempfile::TempDir;
66

77
fn init_git_repo(dir: &Path) -> Result<(), Box<dyn Error>> {
8-
run(dir, ["git", "init"])?;
8+
let init_with_main = StdCommand::new("git")
9+
.current_dir(dir)
10+
.args(["init", "-b", "main"])
11+
.status()?;
12+
13+
if !init_with_main.success() {
14+
run(dir, ["git", "init"])?;
15+
run(dir, ["git", "branch", "-M", "main"])?;
16+
}
17+
918
fs::write(dir.join("README.md"), "test")?;
1019
run(dir, ["git", "add", "README.md"])?;
1120
run(

0 commit comments

Comments
 (0)