diff options
| author | Karsten Tausche <karsten@fairphone.com> | 2022-12-06 09:56:28 +0100 |
|---|---|---|
| committer | Mike Frysinger <vapier@google.com> | 2022-12-08 06:29:00 +0000 |
| commit | 802cd0c6016d91c62c25178ee1ccc1e78505502c (patch) | |
| tree | 48a0ba18e2729bdc5f0acec225514e2c67e91534 /subcmds/sync.py | |
| parent | 100a2143156c9e35d84688da62124f6a629773dd (diff) | |
| download | git-repo-802cd0c6016d91c62c25178ee1ccc1e78505502c.tar.gz | |
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>
Diffstat (limited to 'subcmds/sync.py')
| -rw-r--r-- | subcmds/sync.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 7cf303b3..0c0f0cf3 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -470,6 +470,7 @@ later is required to fix a server side protocol bug. | |||
| 470 | """ | 470 | """ |
| 471 | start = time.time() | 471 | start = time.time() |
| 472 | success = False | 472 | success = False |
| 473 | remote_fetched = False | ||
| 473 | buf = io.StringIO() | 474 | buf = io.StringIO() |
| 474 | try: | 475 | try: |
| 475 | sync_result = project.Sync_NetworkHalf( | 476 | sync_result = project.Sync_NetworkHalf( |
| @@ -487,6 +488,7 @@ later is required to fix a server side protocol bug. | |||
| 487 | clone_filter=project.manifest.CloneFilter, | 488 | clone_filter=project.manifest.CloneFilter, |
| 488 | partial_clone_exclude=project.manifest.PartialCloneExclude) | 489 | partial_clone_exclude=project.manifest.PartialCloneExclude) |
| 489 | success = sync_result.success | 490 | success = sync_result.success |
| 491 | remote_fetched = sync_result.remote_fetched | ||
| 490 | 492 | ||
| 491 | output = buf.getvalue() | 493 | output = buf.getvalue() |
| 492 | if (opt.verbose or not success) and output: | 494 | if (opt.verbose or not success) and output: |
| @@ -504,8 +506,7 @@ later is required to fix a server side protocol bug. | |||
| 504 | raise | 506 | raise |
| 505 | 507 | ||
| 506 | finish = time.time() | 508 | finish = time.time() |
| 507 | return _FetchOneResult(success, project, start, finish, | 509 | return _FetchOneResult(success, project, start, finish, remote_fetched) |
| 508 | sync_result.remote_fetched) | ||
| 509 | 510 | ||
| 510 | @classmethod | 511 | @classmethod |
| 511 | def _FetchInitChild(cls, ssh_proxy): | 512 | def _FetchInitChild(cls, ssh_proxy): |
