Skip to content

Commit 493574e

Browse files
committed
Don't exclude github fast path in shallow clones
It was misunderstood earlier and it's something we'd want as it will quickly conclude that the remote didn't change compared to a reference we would otherwise try to update.
1 parent 2f45cb5 commit 493574e

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/cargo/sources/git/utils.rs

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -852,19 +852,14 @@ pub fn fetch(
852852

853853
// If we're fetching from GitHub, attempt GitHub's special fast path for
854854
// testing if we've already got an up-to-date copy of the repository.
855-
// With shallow histories this is a bit fuzzy, and we opt-out for now.
856-
let is_shallow = repo.is_shallow() || !matches!(shallow, gix::remote::fetch::Shallow::NoChange);
857-
let oid_to_fetch = if is_shallow {
858-
None
859-
} else {
860-
match github_fast_path(repo, orig_url, reference, config) {
861-
Ok(FastPathRev::UpToDate) => return Ok(()),
862-
Ok(FastPathRev::NeedsFetch(rev)) => Some(rev),
863-
Ok(FastPathRev::Indeterminate) => None,
864-
Err(e) => {
865-
debug!("failed to check github {:?}", e);
866-
None
867-
}
855+
let is_shallow = !matches!(shallow, gix::remote::fetch::Shallow::NoChange);
856+
let oid_to_fetch = match github_fast_path(repo, orig_url, reference, config) {
857+
Ok(FastPathRev::UpToDate) => return Ok(()),
858+
Ok(FastPathRev::NeedsFetch(rev)) => Some(rev),
859+
Ok(FastPathRev::Indeterminate) => None,
860+
Err(e) => {
861+
debug!("failed to check github {:?}", e);
862+
None
868863
}
869864
};
870865

0 commit comments

Comments
 (0)