Skip to content

Commit

Permalink
Auto merge of rust-lang#8778 - ehuss:update-git2, r=alexcrichton
Browse files Browse the repository at this point in the history
Update git2.

Closes rust-lang#8517
Closes rust-lang#8588
Closes rust-lang#8352
Closes rust-lang#4777
Closes rust-lang#8746

I only added a test for one of these. I can add for the others if you want.
  • Loading branch information
bors authored and ehuss committed Oct 14, 2020
1 parent 75615f8 commit 4d92bf5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
23 changes: 23 additions & 0 deletions tests/testsuite/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

0 comments on commit 4d92bf5

Please sign in to comment.