summaryrefslogtreecommitdiffstats
path: root/project.py
diff options
context:
space:
mode:
authorKaushik Lingarkar <kaushikl@qti.qualcomm.com>2025-04-07 17:08:07 -0700
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2025-04-17 11:46:11 -0700
commita94457d1ce04b31f63734a8c8a1dc668668af39d (patch)
tree1fb0f11469b63223a083addc23bd44d848747783 /project.py
parent97dc5c1bd9527c2abe2183b16a4b7ef037dc34a7 (diff)
downloadgit-repo-a94457d1ce04b31f63734a8c8a1dc668668af39d.tar.gz
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 <kaushikl@qti.qualcomm.com> Tested-by: Kaushik Lingarkar <kaushikl@qti.qualcomm.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'project.py')
-rw-r--r--project.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/project.py b/project.py
index bf37a0da..2d802f24 100644
--- a/project.py
+++ b/project.py
@@ -2755,6 +2755,14 @@ class Project:
2755 # field; it doesn't exist, thus abort the optimization attempt 2755 # field; it doesn't exist, thus abort the optimization attempt
2756 # and do a full sync. 2756 # and do a full sync.
2757 break 2757 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
2758 elif ret < 0: 2766 elif ret < 0:
2759 # Git died with a signal, exit immediately. 2767 # Git died with a signal, exit immediately.
2760 break 2768 break