Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit dd16c65

Browse files
committed
Fixing command for when neither hg or git are available
Sometimes not hg or git are available to run. On those cases, 'try_to_run' will return None, and we need to not stringify that None
1 parent 3fe855a commit dd16c65

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

codecov/__init__.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,17 +229,15 @@ def _add_env_if_not_empty(lst, value):
229229

230230

231231
def generate_toc(root):
232-
return (
233-
str(
234-
(
235-
try_to_run(["git", "ls-files"], cwd=root)
236-
or try_to_run(["git", "ls-files"])
237-
or try_to_run(["hg", "locate"], cwd=root)
238-
or try_to_run(["hg", "locate"])
239-
)
240-
).strip()
241-
or ""
232+
res = (
233+
try_to_run(["git", "ls-files"], cwd=root)
234+
or try_to_run(["git", "ls-files"])
235+
or try_to_run(["hg", "locate"], cwd=root)
236+
or try_to_run(["hg", "locate"])
242237
)
238+
if res is None:
239+
return ""
240+
return str(res).strip() or ""
243241

244242

245243
def main(*argv, **kwargs):

0 commit comments

Comments
 (0)