Skip to content

Commit

Permalink
don't ask github to resolve full commit hashes
Browse files Browse the repository at this point in the history
Co-authored-by: Weihang Lo <[email protected]>
  • Loading branch information
iliana and weihanglo committed May 22, 2024
1 parent 84dc5dc commit 5d7a06b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,14 @@ fn github_fast_path(
return Ok(FastPathRev::UpToDate);
}
}
// If `rev` is a full commit hash, the only thing it can resolve
// to is itself. Don't bother talking to GitHub in that case
// either. (This ensures that we always attempt to fetch the
// commit directly even if we can't reach the GitHub API.)
if let Ok(oid) = rev.parse() {
debug!("github fast path is already a full commit hash {rev}");
return Ok(FastPathRev::NeedsFetch(oid));
}
rev
} else {
debug!("can't use github fast path with `rev = \"{}\"`", rev);
Expand Down

0 comments on commit 5d7a06b

Please sign in to comment.