sync: Fix undefined variable in _FetchOne

If syncing in _FetchOne fails with GitError, sync_result does not get
set. There's already a separate local variable for success; do the same
for remote_fetched instead of referring to the conditionally defined
named tuple.

This bug is originally caused by a combination of ad8aa697 "sync: only
print error.GitError, don't raise that exception." and 1eddca84 "sync:
use namedtuples for internal return values".

Change-Id: I0f9dbafb97f8268044e5a56a6f92cf29bc23ca6a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354176
Tested-by: Karsten Tausche <karsten@fairphone.com>
Reviewed-by: LaMont Jones <lamontjones@google.com>
This commit is contained in:
Karsten Tausche 2022-12-06 09:56:28 +01:00 committed by Mike Frysinger
parent 100a214315
commit 802cd0c601

View File

@ -470,6 +470,7 @@ later is required to fix a server side protocol bug.
""" """
start = time.time() start = time.time()
success = False success = False
remote_fetched = False
buf = io.StringIO() buf = io.StringIO()
try: try:
sync_result = project.Sync_NetworkHalf( sync_result = project.Sync_NetworkHalf(
@ -487,6 +488,7 @@ later is required to fix a server side protocol bug.
clone_filter=project.manifest.CloneFilter, clone_filter=project.manifest.CloneFilter,
partial_clone_exclude=project.manifest.PartialCloneExclude) partial_clone_exclude=project.manifest.PartialCloneExclude)
success = sync_result.success success = sync_result.success
remote_fetched = sync_result.remote_fetched
output = buf.getvalue() output = buf.getvalue()
if (opt.verbose or not success) and output: if (opt.verbose or not success) and output:
@ -504,8 +506,7 @@ later is required to fix a server side protocol bug.
raise raise
finish = time.time() finish = time.time()
return _FetchOneResult(success, project, start, finish, return _FetchOneResult(success, project, start, finish, remote_fetched)
sync_result.remote_fetched)
@classmethod @classmethod
def _FetchInitChild(cls, ssh_proxy): def _FetchInitChild(cls, ssh_proxy):