Skip to content

Commit 33b7cb1

Browse files
committed
zero out branch variable when cloning failed
1 parent 9ef163e commit 33b7cb1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

completion.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def branches_from_devguide(devguide_dir: Path) -> list[str]:
2020
]
2121

2222

23-
def get_completion(clones_dir: str, repo: str) -> tuple[float, 'TranslatorsData', str]:
23+
def get_completion(
24+
clones_dir: str, repo: str
25+
) -> tuple[float, 'TranslatorsData', str | None]:
2426
clone_path = Path(clones_dir, repo)
2527
for branch in branches_from_devguide(Path(clones_dir, 'devguide')) + [
2628
'master',
@@ -33,6 +35,7 @@ def get_completion(clones_dir: str, repo: str) -> tuple[float, 'TranslatorsData'
3335
except git.GitCommandError:
3436
print(f'failed to clone {repo} {branch}')
3537
translators_data = TranslatorsData(0, False)
38+
branch = ''
3639
continue
3740
else:
3841
translators_number = translators.get_number(clone_path)
@@ -47,7 +50,7 @@ def get_completion(clones_dir: str, repo: str) -> tuple[float, 'TranslatorsData'
4750
hide_reserved=False,
4851
api_url='',
4952
).completion
50-
return completion, translators_data, branch
53+
return completion, translators_data, branch or None
5154

5255

5356
@dataclass(frozen=True)

0 commit comments

Comments
 (0)