Skip to content

Commit 5d7a06b

Browse files
ilianaweihanglo
andcommitted
don't ask github to resolve full commit hashes
Co-authored-by: Weihang Lo <[email protected]>
1 parent 84dc5dc commit 5d7a06b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cargo/sources/git/utils.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,14 @@ fn github_fast_path(
14171417
return Ok(FastPathRev::UpToDate);
14181418
}
14191419
}
1420+
// If `rev` is a full commit hash, the only thing it can resolve
1421+
// to is itself. Don't bother talking to GitHub in that case
1422+
// either. (This ensures that we always attempt to fetch the
1423+
// commit directly even if we can't reach the GitHub API.)
1424+
if let Ok(oid) = rev.parse() {
1425+
debug!("github fast path is already a full commit hash {rev}");
1426+
return Ok(FastPathRev::NeedsFetch(oid));
1427+
}
14201428
rev
14211429
} else {
14221430
debug!("can't use github fast path with `rev = \"{}\"`", rev);

0 commit comments

Comments
 (0)