Skip to content
Merged
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
8 changes: 5 additions & 3 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ pub fn fetch(
fast_path_rev = true;
refspecs.push(format!("+{0}:refs/commit/{0}", oid_to_fetch));
} else if !matches!(shallow, gix::remote::fetch::Shallow::NoChange)
&& rev.parse::<Oid>().is_ok()
&& rev_to_oid(rev).is_some()
{
// There is a specific commit to fetch and we will do so in shallow-mode only
// to not disturb the previous logic.
Expand Down Expand Up @@ -1569,8 +1569,10 @@ fn github_fast_path(
if response_code == 304 {
debug!("github fast path up-to-date");
Ok(FastPathRev::UpToDate)
} else if response_code == 200 {
let oid_to_fetch = str::from_utf8(&response_body)?.parse::<Oid>()?;
} else if response_code == 200
&& let Some(oid_to_fetch) = rev_to_oid(str::from_utf8(&response_body)?)
{
// response expected to be a full hash hexstring (40 or 64 chars)
debug!("github fast path fetch {oid_to_fetch}");
Ok(FastPathRev::NeedsFetch(oid_to_fetch))
} else {
Expand Down