File: Fallback-to-full-sync-when-depth-enabled-fetch-of-a-sh.patch

package info (click to toggle)
repo 2.54-1
  • links: PTS, VCS
  • area: contrib
  • in suites: trixie
  • size: 1,856 kB
  • sloc: python: 20,028; sh: 99; makefile: 13
file content (41 lines) | stat: -rw-r--r-- 1,824 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From: Kaushik Lingarkar <kaushikl@qti.qualcomm.com>
Date: Mon, 7 Apr 2025 17:08:07 -0700
Subject: 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>
(cherry picked from commit a94457d1ce04b31f63734a8c8a1dc668668af39d)
---
 project.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/project.py b/project.py
index bf37a0d..2d802f2 100644
--- a/project.py
+++ b/project.py
@@ -2755,6 +2755,14 @@ class Project:
                 # field; it doesn't exist, thus abort the optimization attempt
                 # and do a full sync.
                 break
+            elif depth and is_sha1 and ret == 1:
+                # 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
+                # without depth.
+                break
             elif ret < 0:
                 # Git died with a signal, exit immediately.
                 break