mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-05-08 20:09:40 +00:00
project: Avoid skipping fetches for shallow clones without .git/shallow
When optimizing fetches for projects with immutable revisions, the fetch should not be skipped if the project is configured for a shallow clone (depth > 0) but the .git/shallow file is missing. The absence of the .git/shallow file means the repository is not a shallow clone, or the shallow clone is incomplete, so a fetch is necessary to ensure the revision is present. Bug: 503081454 Change-Id: Ic3549612bcd69050a926652ee4e522c79ad8124c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/573821 Tested-by: Becky Siegel <beckysiegel@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Becky Siegel <beckysiegel@google.com>
This commit is contained in:
@@ -1495,6 +1495,10 @@ class Project:
|
||||
and self._CheckForImmutableRevision(
|
||||
use_superproject=use_superproject
|
||||
)
|
||||
and (
|
||||
not depth
|
||||
or os.path.exists(os.path.join(self.gitdir, "shallow"))
|
||||
)
|
||||
):
|
||||
remote_fetched = True
|
||||
try:
|
||||
@@ -2616,6 +2620,9 @@ class Project:
|
||||
if is_sha1 or tag_name is not None:
|
||||
if self._CheckForImmutableRevision(
|
||||
use_superproject=use_superproject
|
||||
) and (
|
||||
not depth
|
||||
or os.path.exists(os.path.join(self.gitdir, "shallow"))
|
||||
):
|
||||
if verbose:
|
||||
print(
|
||||
|
||||
Reference in New Issue
Block a user