Update git2.

This commit is contained in:
Eric Huss 2020-10-13 18:13:25 -07:00
parent 31e1f1f786
commit 0be75d2edc
2 changed files with 25 additions and 2 deletions

View file

@ -32,7 +32,7 @@ pretty_env_logger = { version = "0.4", optional = true }
anyhow = "1.0"
filetime = "0.2.9"
flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] }
git2 = "0.13.5"
git2 = "0.13.12"
git2-curl = "0.14.0"
glob = "0.3.0"
hex = "0.4"
@ -44,7 +44,7 @@ jobserver = "0.1.21"
lazycell = "1.2.0"
libc = "0.2"
log = "0.4.6"
libgit2-sys = "0.12.7"
libgit2-sys = "0.12.14"
memchr = "2.1.3"
num_cpus = "1.0"
opener = "0.4"

View file

@ -602,3 +602,26 @@ If you need a crate name to not match the directory name, consider using --name
)
.run();
}
#[cargo_test]
fn git_default_branch() {
// Check for init.defaultBranch support.
create_empty_gitconfig();
cargo_process("new foo").env("USER", "foo").run();
let repo = git2::Repository::open(paths::root().join("foo")).unwrap();
let head = repo.find_reference("HEAD").unwrap();
assert_eq!(head.symbolic_target().unwrap(), "refs/heads/master");
fs::write(
paths::home().join(".gitconfig"),
r#"
[init]
defaultBranch = hello
"#,
)
.unwrap();
cargo_process("new bar").env("USER", "foo").run();
let repo = git2::Repository::open(paths::root().join("bar")).unwrap();
let head = repo.find_reference("HEAD").unwrap();
assert_eq!(head.symbolic_target().unwrap(), "refs/heads/hello");
}