From 0e8828c47b509186f275d5c25108323c6c296214 Mon Sep 17 00:00:00 2001 From: Craig Northway Date: Wed, 5 May 2021 08:49:26 -0700 Subject: [PATCH] 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 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/305382 Reviewed-by: Mike Frysinger --- repo | 11 +++++------ 1 file 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(): # If the python3 version looks like it's new enough, give it a try. if (python3_ver and python3_ver >= MIN_PYTHON_VERSION_HARD - and python3_ver != (major, minor)): + and python3_ver != (major, minor)): reexec('python3') # We're still here, so diagnose things for the user. @@ -859,11 +859,10 @@ def _DownloadBundle(url, cwd, quiet, verbose): try: r = urllib.request.urlopen(url) except urllib.error.HTTPError as e: - if e.code in [401, 403, 404, 501]: - return False - print('fatal: Cannot get %s' % url, file=sys.stderr) - print('fatal: HTTP error %s' % e.code, file=sys.stderr) - raise CloneFailure() + if e.code not in [400, 401, 403, 404, 501]: + print('warning: Cannot get %s' % url, file=sys.stderr) + print('warning: HTTP error %s' % e.code, file=sys.stderr) + return False except urllib.error.URLError as e: print('fatal: Cannot get %s' % url, file=sys.stderr) print('fatal: error %s' % e.reason, file=sys.stderr)