project: accept v3 git bundles in _IsValidBundle

Git 2.29+ introduced v3 bundle headers (`# v3 git bundle`) for SHA-256
and filtered bundles. Allow both v2 and v3 bundle headers when
validating downloaded `clone.bundle` files.

Bug: 576377949
Change-Id: Ic5ac94bf535a801d948f8932213e62a6cd132cac
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/647123
Tested-by: Brian Gan <brgan@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Brian Gan <brgan@google.com>
This commit is contained in:
Brian Gan authored and gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com committed 2026-10-21 16:04:30 -07:00
1 parent f0124d0fd5
commit d744eb15f3
1 file changed
+1 -1
+1 -1
View File
@@ -3874,7 +3874,7 @@ class Project:
def _IsValidBundle(self, path, quiet):
try:
with open(path, "rb") as f:
if f.read(16) == b"# v2 git bundle\n":
if f.read(16) in (b"# v2 git bundle\n", b"# v3 git bundle\n"):
return True
else:
if not quiet: