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>
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 7cf303b..0c0f0cf 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -470,6 +470,7 @@
"""
start = time.time()
success = False
+ remote_fetched = False
buf = io.StringIO()
try:
sync_result = project.Sync_NetworkHalf(
@@ -487,6 +488,7 @@
clone_filter=project.manifest.CloneFilter,
partial_clone_exclude=project.manifest.PartialCloneExclude)
success = sync_result.success
+ remote_fetched = sync_result.remote_fetched
output = buf.getvalue()
if (opt.verbose or not success) and output:
@@ -504,8 +506,7 @@
raise
finish = time.time()
- return _FetchOneResult(success, project, start, finish,
- sync_result.remote_fetched)
+ return _FetchOneResult(success, project, start, finish, remote_fetched)
@classmethod
def _FetchInitChild(cls, ssh_proxy):