diff options
author | Konrad Weihmann <kweihmann@outlook.com> | 2020-04-17 21:39:32 +0200 |
---|---|---|
committer | K Weihmann <kweihmann@outlook.com> | 2020-04-28 17:02:46 +0000 |
commit | 433977e95812f0839796efdf4fae5863efe2025b (patch) | |
tree | 7956575dc9bc11a3e9df7e25c4f5943f6e0a2574 | |
parent | dd37fb22227f2abfb4b4f657dded42d422ac2e9c (diff) | |
download | git-repo-433977e95812f0839796efdf4fae5863efe2025b.tar.gz |
repo: exit on missing entry point
exit if no repo_main can be found right before executing the command.
This happens for instance when 'repo init' is run on root path
(for example in a container). Without this counter measure the tool
will crash at exec_command with
TypeError: sequence item 1: expected str instance, NoneType found
Change-Id: Ia8480cfe2151c3b35c9572789ad8cb619288cce1
Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263457
Reviewed-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@digital.ai>
-rwxr-xr-x | repo | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1169,6 +1169,10 @@ def main(orig_args): | |||
1169 | if my_main: | 1169 | if my_main: |
1170 | repo_main = my_main | 1170 | repo_main = my_main |
1171 | 1171 | ||
1172 | if not repo_main: | ||
1173 | print("fatal: unable to find repo entry point", file=sys.stderr) | ||
1174 | sys.exit(1) | ||
1175 | |||
1172 | ver_str = '.'.join(map(str, VERSION)) | 1176 | ver_str = '.'.join(map(str, VERSION)) |
1173 | me = [sys.executable, repo_main, | 1177 | me = [sys.executable, repo_main, |
1174 | '--repo-dir=%s' % rel_repo_dir, | 1178 | '--repo-dir=%s' % rel_repo_dir, |