project: fix http error retry logic
When sync moved to consume clone output, it merged stdout & stderr,
but the retry logic in this function is based on stderr only. Move
it over to checking stdout.
Change-Id: I71bdc18ed25c978055952721e3a768289d7a3bd2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297902
Reviewed-by: Michael Mortensen <mmortensen@google.com>
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
diff --git a/project.py b/project.py
index da67c36..de7bbbc 100644
--- a/project.py
+++ b/project.py
@@ -2135,8 +2135,9 @@
break
# Retry later due to HTTP 429 Too Many Requests.
- elif ('error:' in gitcmd.stderr and
- 'HTTP 429' in gitcmd.stderr):
+ elif (gitcmd.stdout and
+ 'error:' in gitcmd.stdout and
+ 'HTTP 429' in gitcmd.stdout):
if not quiet:
print('429 received, sleeping: %s sec' % retry_cur_sleep,
file=sys.stderr)
@@ -2149,8 +2150,9 @@
# If this is not last attempt, try 'git remote prune'.
elif (try_n < retry_fetches - 1 and
- 'error:' in gitcmd.stderr and
- 'git remote prune' in gitcmd.stderr and
+ gitcmd.stdout and
+ 'error:' in gitcmd.stdout and
+ 'git remote prune' in gitcmd.stdout and
not prune_tried):
prune_tried = True
prunecmd = GitCommand(self, ['remote', 'prune', name], bare=True,