summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Northway <cnorthway@codeaurora.org>2021-05-05 08:49:26 -0700
committerMike Frysinger <vapier@google.com>2021-05-10 16:34:34 +0000
commit0e8828c47b509186f275d5c25108323c6c296214 (patch)
tree047170b4be9f8d0a2ba1f140222f858933100eb7
parent23ea7545244e4bae1fdaed360fa8c25225fa03ec (diff)
downloadgit-repo-0e8828c47b509186f275d5c25108323c6c296214.tar.gz
Handle 400 error code when attempting to fetch clone bundle.
Gitlab returns a 400 error when trying to fetch clone.bundle from a repository containing the git-repo tool. The repo launcher doesn't then fall back to not using a clone.bundle file and the repo init fails. Change-Id: Ia3390d0638ef9a39fb2fab84625b269d28caf1cc Signed-off-by: Craig Northway <cnorthway@codeaurora.org> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305382 Reviewed-by: Mike Frysinger <vapier@google.com>
-rwxr-xr-xrepo11
1 files changed, 5 insertions, 6 deletions
diff --git a/repo b/repo
index f17c8a6f..8e0c810e 100755
--- a/repo
+++ b/repo
@@ -117,7 +117,7 @@ def check_python_version():
117 117
118 # If the python3 version looks like it's new enough, give it a try. 118 # If the python3 version looks like it's new enough, give it a try.
119 if (python3_ver and python3_ver >= MIN_PYTHON_VERSION_HARD 119 if (python3_ver and python3_ver >= MIN_PYTHON_VERSION_HARD
120 and python3_ver != (major, minor)): 120 and python3_ver != (major, minor)):
121 reexec('python3') 121 reexec('python3')
122 122
123 # We're still here, so diagnose things for the user. 123 # We're still here, so diagnose things for the user.
@@ -859,11 +859,10 @@ def _DownloadBundle(url, cwd, quiet, verbose):
859 try: 859 try:
860 r = urllib.request.urlopen(url) 860 r = urllib.request.urlopen(url)
861 except urllib.error.HTTPError as e: 861 except urllib.error.HTTPError as e:
862 if e.code in [401, 403, 404, 501]: 862 if e.code not in [400, 401, 403, 404, 501]:
863 return False 863 print('warning: Cannot get %s' % url, file=sys.stderr)
864 print('fatal: Cannot get %s' % url, file=sys.stderr) 864 print('warning: HTTP error %s' % e.code, file=sys.stderr)
865 print('fatal: HTTP error %s' % e.code, file=sys.stderr) 865 return False
866 raise CloneFailure()
867 except urllib.error.URLError as e: 866 except urllib.error.URLError as e:
868 print('fatal: Cannot get %s' % url, file=sys.stderr) 867 print('fatal: Cannot get %s' % url, file=sys.stderr)
869 print('fatal: error %s' % e.reason, file=sys.stderr) 868 print('fatal: error %s' % e.reason, file=sys.stderr)