mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Fix new::git_default_branch with different default
The test new::git_default_branch would fail if the current user had already configured a different default branch. This patch changes the test to first write a .gitconfig file with the default branch set to master. This puts us in a state where we still have the old default, and then the subsequent change to the config file will make sure that config changes are still respected.
This commit is contained in:
parent
95bb3c92bf
commit
40c51392dd
@ -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();
|
||||
|
||||
cargo_process("new foo").run();
|
||||
let repo = git2::Repository::open(paths::root().join("foo")).unwrap();
|
||||
let head = repo.find_reference("HEAD").unwrap();
|
||||
|
Loading…
x
Reference in New Issue
Block a user