mirror of
https://github.com/rust-lang/cargo
synced 2024-10-30 12:35:34 +00:00
parent
3361918384
commit
a85c917b6b
7 changed files with 16 additions and 20 deletions
|
@ -28,8 +28,8 @@ 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"
|
||||
git2-curl = "0.8"
|
||||
glob = "0.2"
|
||||
hex = "0.3"
|
||||
home = "0.3"
|
||||
|
@ -37,7 +37,7 @@ 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"
|
||||
|
@ -91,4 +91,4 @@ doc = false
|
|||
|
||||
[[test]]
|
||||
name = "testsuite"
|
||||
path = "tests/testsuite/lib.rs"
|
||||
path = "tests/testsuite/lib.rs"
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
@ -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,
|
||||
|
@ -462,7 +462,7 @@ 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
|
||||
|
@ -470,7 +470,7 @@ fn with_authentication<T, F>(url: &str, cfg: &git2::Config, mut f: F)
|
|||
|
||||
// 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()
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}
|
||||
}))));
|
||||
|
|
Loading…
Reference in a new issue