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

Update git2 to 0.7.0 #5091

Merged
merged 1 commit into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
Update git2 to 0.7.0
  • Loading branch information
alexcrichton committed Feb 27, 2018
commit a85c917b6b7169d4a9a89a92756d5f3068cd4187
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ failure = "0.1.1"
filetime = "0.1"
flate2 = "1.0"
fs2 = "0.4"
git2 = "0.6.11"
git2-curl = "0.7"
git2 = "0.7.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know if this is intentional or not, but looks like /~https://github.com/alexcrichton/git2-rs does not contain commit which actually bumps the versions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops forgot to do git push

git2-curl = "0.8"
glob = "0.2"
hex = "0.3"
home = "0.3"
ignore = "0.4"
jobserver = "0.1.9"
lazycell = "0.6"
libc = "0.2"
libgit2-sys = "0.6"
libgit2-sys = "0.7"
log = "0.4"
num_cpus = "1.0"
same-file = "1"
Expand Down Expand Up @@ -91,4 +91,4 @@ doc = false

[[test]]
name = "testsuite"
path = "tests/testsuite/lib.rs"
path = "tests/testsuite/lib.rs"
4 changes: 2 additions & 2 deletions src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fn check_not_dirty(p: &Package, src: &PathSource) -> CargoResult<()> {
let path = p.manifest_path();
let path = path.strip_prefix(workdir).unwrap_or(path);
if let Ok(status) = repo.status_file(path) {
if (status & git2::STATUS_IGNORED).is_empty() {
if (status & git2::Status::IGNORED).is_empty() {
debug!("Cargo.toml found in repo, checking if dirty");
return git(p, src, &repo)
}
Expand All @@ -165,7 +165,7 @@ fn check_not_dirty(p: &Package, src: &PathSource) -> CargoResult<()> {
let dirty = src.list_files(p)?.iter().filter(|file| {
let relative = file.strip_prefix(workdir).unwrap();
if let Ok(status) = repo.status_file(relative) {
status != git2::STATUS_CURRENT
status != git2::Status::CURRENT
} else {
false
}
Expand Down
12 changes: 6 additions & 6 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
// usernames during one authentication session with libgit2, so to
// handle this we bail out of this authentication session after setting
// the flag `ssh_username_requested`, and then we handle this below.
if allowed.contains(git2::USERNAME) {
if allowed.contains(git2::CredentialType::USERNAME) {
debug_assert!(username.is_none());
ssh_username_requested = true;
return Err(git2::Error::from_str("gonna try usernames later"))
Expand All @@ -445,7 +445,7 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
// If we get called with this then the only way that should be possible
// is if a username is specified in the URL itself (e.g. `username` is
// Some), hence the unwrap() here. We try custom usernames down below.
if allowed.contains(git2::SSH_KEY) && !tried_sshkey {
if allowed.contains(git2::CredentialType::SSH_KEY) && !tried_sshkey {
// If ssh-agent authentication fails, libgit2 will keep
// calling this callback asking for other authentication
// methods to try. Make sure we only try ssh-agent once,
Expand All @@ -462,15 +462,15 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
// but we currently don't! Right now the only way we support fetching a
// plaintext password is through the `credential.helper` support, so
// fetch that here.
if allowed.contains(git2::USER_PASS_PLAINTEXT) {
if allowed.contains(git2::CredentialType::USER_PASS_PLAINTEXT) {
let r = git2::Cred::credential_helper(cfg, url, username);
cred_helper_bad = Some(r.is_err());
return r
}

// I'm... not sure what the DEFAULT kind of authentication is, but seems
// easy to support?
if allowed.contains(git2::DEFAULT) {
if allowed.contains(git2::CredentialType::DEFAULT) {
return git2::Cred::default()
}

Expand Down Expand Up @@ -507,10 +507,10 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
// we bail out.
let mut attempts = 0;
res = f(&mut |_url, username, allowed| {
if allowed.contains(git2::USERNAME) {
if allowed.contains(git2::CredentialType::USERNAME) {
return git2::Cred::username(&s);
}
if allowed.contains(git2::SSH_KEY) {
if allowed.contains(git2::CredentialType::SSH_KEY) {
debug_assert_eq!(Some(&s[..]), username);
attempts += 1;
if attempts == 1 {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/sources/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ impl<'cfg> PathSource<'cfg> {
let statuses = repo.statuses(Some(&mut opts))?;
let untracked = statuses.iter().filter_map(|entry| {
match entry.status() {
git2::STATUS_WT_NEW => Some((join(root, entry.path_bytes()), None)),
git2::Status::WT_NEW => Some((join(root, entry.path_bytes()), None)),
_ => None,
}
});
Expand Down
6 changes: 1 addition & 5 deletions tests/testsuite/build_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ fn http_auth_offered() {
let t = thread::spawn(move|| {
let mut conn = BufStream::new(server.accept().unwrap().0);
let req = headers(&mut conn);
let user_agent = if cfg!(windows) {
"User-Agent: git/1.0 (libgit2 0.26.0)"
} else {
"User-Agent: git/2.0 (libgit2 0.26.0)"
};
let user_agent = "User-Agent: git/2.0 (libgit2 0.27.0)";
conn.write_all(b"\
HTTP/1.1 401 Unauthorized\r\n\
WWW-Authenticate: Basic realm=\"wheee\"\r\n
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargotest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ path = "lib.rs"
cargo = { path = "../../.." }
filetime = "0.1"
flate2 = "1.0"
git2 = { version = "0.6", default-features = false }
git2 = { version = "0.7", default-features = false }
hamcrest = "=0.1.1"
hex = "0.3"
log = "0.4"
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargotest/support/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub fn add(repo: &git2::Repository) {
t!(submodule.add_to_index(false));
}
let mut index = t!(repo.index());
t!(index.add_all(["*"].iter(), git2::ADD_DEFAULT,
t!(index.add_all(["*"].iter(), git2::IndexAddOption::DEFAULT,
Some(&mut (|a, _b| {
if s.iter().any(|s| a.starts_with(s.path())) {1} else {0}
}))));
Expand Down