Skip to content

Commit ac32aa8

Browse files
committed
Auto merge of #11928 - ehuss:update-git2, r=epage
Update git2 This updates git2 from 0.16 to 0.17, which updates libgit2 from 1.5.0 to 1.6.3. This is quite a large update (particularly around SSH handling), so this update is fairly risky. All of the issues I'm aware of have been resolved. Due to some changes in how libgit2 handles SSH agent errors, I tweaked the wording of the error generated by cargo when all authentications fail. Previously, libgit2 would abort the authentication when an ssh-agent connection failed. Changelog for git2: https://github.com/rust-lang/git2-rs/blob/master/CHANGELOG.md#0170---2023-04-02 Changelog for libgit2: https://github.com/libgit2/libgit2/blob/main/docs/changelog.md#v163 Closes #11611
2 parents 0240187 + 78970bd commit ac32aa8

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ curl-sys = "0.4.61"
2828
env_logger = "0.10.0"
2929
filetime = "0.2.9"
3030
flate2 = { version = "1.0.3", default-features = false, features = ["zlib"] }
31-
git2 = "0.16.0"
32-
git2-curl = "0.17.0"
31+
git2 = "0.17.0"
32+
git2-curl = "0.18.0"
3333
gix = { version = "0.39.0", default-features = false, features = ["blocking-http-transport-curl", "progress-tree"] }
3434
gix-features-for-configuration-only = { version = "0.28.0", package = "gix-features", features = [ "parallel" ] }
3535
glob = "0.3.0"
@@ -47,9 +47,7 @@ jobserver = "0.1.26"
4747
lazy_static = "1.2.0"
4848
lazycell = "1.2.0"
4949
libc = "0.2"
50-
# Temporarily pin libgit2-sys due to some issues with SSH not working on
51-
# Windows.
52-
libgit2-sys = "=0.14.1"
50+
libgit2-sys = "0.15.0"
5351
log = "0.4.6"
5452
memchr = "2.1.3"
5553
opener = "0.5"

crates/cargo-test-support/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cargo-util = { path = "../cargo-util" }
1414
crates-io = { path = "../crates-io" }
1515
filetime = "0.2"
1616
flate2 = { version = "1.0", default-features = false, features = ["zlib"] }
17-
git2 = "0.16.0"
17+
git2 = "0.17.0"
1818
glob = "0.3"
1919
itertools = "0.10.0"
2020
lazy_static = "1.0"

src/cargo/sources/git/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ where
567567
}
568568

569569
// Whelp, we tried our best
570-
Err(git2::Error::from_str("no authentication available"))
570+
Err(git2::Error::from_str("no authentication methods succeeded"))
571571
});
572572

573573
// Ok, so if it looks like we're going to be doing ssh authentication, we
@@ -612,7 +612,7 @@ where
612612
return git2::Cred::ssh_key_from_agent(&s);
613613
}
614614
}
615-
Err(git2::Error::from_str("no authentication available"))
615+
Err(git2::Error::from_str("no authentication methods succeeded"))
616616
});
617617

618618
// If we made two attempts then that means:

tests/testsuite/https.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn self_signed_should_fail() {
3030
.build();
3131
// I think the text here depends on the curl backend.
3232
let err_msg = if cfg!(target_os = "macos") {
33-
"untrusted connection error; class=Ssl (16); code=Certificate (-17)"
33+
"unexpected return value from ssl handshake -9806; class=Ssl (16)"
3434
} else if cfg!(unix) {
3535
"the SSL certificate is invalid; class=Ssl (16); code=Certificate (-17)"
3636
} else if cfg!(windows) {

tests/testsuite/ssh.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -469,11 +469,6 @@ Caused by:
469469
failed to authenticate when downloading repository
470470
471471
*";
472-
let err = if cfg!(windows) {
473-
"error authenticating: unable to connect to agent pipe; class=Ssh (23)"
474-
} else {
475-
"error authenticating: failed connecting with agent; class=Ssh (23)"
476-
};
477472
let expected = if cargo_uses_gitoxide() {
478473
format!(
479474
"{shared_stderr} attempted to find username/password via `credential.helper`, but maybe the found credentials were incorrect
@@ -496,7 +491,7 @@ Caused by:
496491
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
497492
498493
Caused by:
499-
{err}
494+
no authentication methods succeeded
500495
"
501496
)
502497
};
@@ -546,7 +541,7 @@ Caused by:
546541
https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli
547542
548543
Caused by:
549-
{err}
544+
no authentication methods succeeded
550545
"
551546
)
552547
};

0 commit comments

Comments
 (0)