mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Allow dependency's rev to refer to a ref by name
This commit is contained in:
parent
72aee9e815
commit
256213a655
@ -799,13 +799,17 @@ pub fn fetch(
|
||||
refspecs.push(String::from("HEAD:refs/remotes/origin/HEAD"));
|
||||
}
|
||||
|
||||
// For `rev` dependencies we don't know what the rev will point to. To
|
||||
// handle this situation we fetch all branches and tags, and then we
|
||||
// pray it's somewhere in there.
|
||||
GitReference::Rev(_) => {
|
||||
refspecs.push(String::from("refs/heads/*:refs/remotes/origin/*"));
|
||||
refspecs.push(String::from("HEAD:refs/remotes/origin/HEAD"));
|
||||
tags = true;
|
||||
GitReference::Rev(rev) => {
|
||||
if rev.starts_with("refs/") {
|
||||
refspecs.push(format!("{0}:{0}", rev));
|
||||
} else {
|
||||
// We don't know what the rev will point to. To handle this
|
||||
// situation we fetch all branches and tags, and then we pray
|
||||
// it's somewhere in there.
|
||||
refspecs.push(String::from("refs/heads/*:refs/remotes/origin/*"));
|
||||
refspecs.push(String::from("HEAD:refs/remotes/origin/HEAD"));
|
||||
tags = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user