Skip to content

Commit 0782ffc

Browse files
authored
Merge pull request #165 from sh-at-cs/fix-gh-164-explicit-branch-name
Init test repo with explicit branch
2 parents 80086cb + 7ebcd01 commit 0782ffc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tests/repo_utils.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ impl Context {
1515
/// Prepare a fresh git repository with an initial commit and a file.
1616
pub fn prepare_repo() -> (Context, PathBuf) {
1717
let dir = tempfile::tempdir().unwrap();
18-
let repo = git2::Repository::init(dir.path()).unwrap();
18+
let repo = git2::Repository::init_opts(
19+
dir.path(),
20+
git2::RepositoryInitOptions::new().initial_head("master"),
21+
)
22+
.unwrap();
1923
become_author(&repo, "nobody", "[email protected]");
2024

2125
let path = PathBuf::from("test-file.txt");

0 commit comments

Comments
 (0)