Skip to content

Commit 60194f2

Browse files
committed
Auto merge of #8778 - ehuss:update-git2, r=alexcrichton
Update git2. Closes #8517 Closes #8588 Closes #8352 Closes #4777 Closes #8746 I only added a test for one of these. I can add for the others if you want.
2 parents 31e1f1f + 0be75d2 commit 60194f2

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pretty_env_logger = { version = "0.4", optional = true }
3232
anyhow = "1.0"
3333
filetime = "0.2.9"
3434
flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] }
35-
git2 = "0.13.5"
35+
git2 = "0.13.12"
3636
git2-curl = "0.14.0"
3737
glob = "0.3.0"
3838
hex = "0.4"
@@ -44,7 +44,7 @@ jobserver = "0.1.21"
4444
lazycell = "1.2.0"
4545
libc = "0.2"
4646
log = "0.4.6"
47-
libgit2-sys = "0.12.7"
47+
libgit2-sys = "0.12.14"
4848
memchr = "2.1.3"
4949
num_cpus = "1.0"
5050
opener = "0.4"

tests/testsuite/new.rs

+23
Original file line numberDiff line numberDiff line change
@@ -602,3 +602,26 @@ If you need a crate name to not match the directory name, consider using --name
602602
)
603603
.run();
604604
}
605+
606+
#[cargo_test]
607+
fn git_default_branch() {
608+
// Check for init.defaultBranch support.
609+
create_empty_gitconfig();
610+
cargo_process("new foo").env("USER", "foo").run();
611+
let repo = git2::Repository::open(paths::root().join("foo")).unwrap();
612+
let head = repo.find_reference("HEAD").unwrap();
613+
assert_eq!(head.symbolic_target().unwrap(), "refs/heads/master");
614+
615+
fs::write(
616+
paths::home().join(".gitconfig"),
617+
r#"
618+
[init]
619+
defaultBranch = hello
620+
"#,
621+
)
622+
.unwrap();
623+
cargo_process("new bar").env("USER", "foo").run();
624+
let repo = git2::Repository::open(paths::root().join("bar")).unwrap();
625+
let head = repo.find_reference("HEAD").unwrap();
626+
assert_eq!(head.symbolic_target().unwrap(), "refs/heads/hello");
627+
}

0 commit comments

Comments
 (0)