Skip to content

Commit a94457d

Browse files
quic-kaushiklLUCI
authored and
LUCI
committed
Fallback to full sync when depth enabled fetch of a sha1 fails
In sha1 mode, when depth is enabled, syncing the revision from upstream may not work because some servers only allow fetching named refs. Fetching a specific sha1 may result in an error like 'server does not allow request for unadvertised object'. In this case, attempt a full sync with depth disabled. Bug: 410825502 Change-Id: If51bcf18b877cd9491706f5bc3d6fd13c0c3d4f3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/468282 Commit-Queue: Kaushik Lingarkar <[email protected]> Tested-by: Kaushik Lingarkar <[email protected]> Reviewed-by: Gavin Mak <[email protected]> Reviewed-by: Mike Frysinger <[email protected]>
1 parent 97dc5c1 commit a94457d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

project.py

+8
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,14 @@ def _RemoteFetch(
27552755
# field; it doesn't exist, thus abort the optimization attempt
27562756
# and do a full sync.
27572757
break
2758+
elif depth and is_sha1 and ret == 1:
2759+
# In sha1 mode, when depth is enabled, syncing the revision
2760+
# from upstream may not work because some servers only allow
2761+
# fetching named refs. Fetching a specific sha1 may result
2762+
# in an error like 'server does not allow request for
2763+
# unadvertised object'. In this case, attempt a full sync
2764+
# without depth.
2765+
break
27582766
elif ret < 0:
27592767
# Git died with a signal, exit immediately.
27602768
break

0 commit comments

Comments
 (0)