Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new::git_default_branch with different default #10306

Merged
merged 2 commits into from
Jan 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/testsuite/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,19 @@ or change the name in Cargo.toml with:
fn git_default_branch() {
// Check for init.defaultBranch support.
create_empty_gitconfig();

// If we're running this under a user account that has a different default branch set up
// this test will fail. We avoid that setting the defaultBranch and then ensuring that
// the changed setting is respected.
fs::write(
paths::home().join(".gitconfig"),
r#"
[init]
defaultBranch = master
"#,
)
.unwrap();
eholk marked this conversation as resolved.
Show resolved Hide resolved

cargo_process("new foo").run();
let repo = git2::Repository::open(paths::root().join("foo")).unwrap();
let head = repo.find_reference("HEAD").unwrap();
Expand Down