diff options
author | Ryan <fauxpark@gmail.com> | 2020-12-21 01:46:01 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-20 15:46:01 +0100 |
commit | 0239ce025aca542e4e37ec9003399bab2e92d82b (patch) | |
tree | 15cc1f12cf5155f10b14be97e73f04b363872d21 /lib/python/qmk/cli | |
parent | 13bbeefc5af557abb1dc577bfafc709c5e09def0 (diff) | |
download | qmk_firmware-0239ce025aca542e4e37ec9003399bab2e92d82b.tar.gz qmk_firmware-0239ce025aca542e4e37ec9003399bab2e92d82b.zip |
Doctor: add check for .git folder (#11208)
Co-authored-by: Erovia <Erovia@users.noreply.github.com>
Diffstat (limited to 'lib/python/qmk/cli')
-rwxr-xr-x | lib/python/qmk/cli/doctor.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/doctor.py b/lib/python/qmk/cli/doctor.py index 25e2e239c..ea1113c64 100755 --- a/lib/python/qmk/cli/doctor.py +++ b/lib/python/qmk/cli/doctor.py | |||
@@ -154,6 +154,17 @@ def check_submodules(): | |||
154 | return CheckStatus.OK | 154 | return CheckStatus.OK |
155 | 155 | ||
156 | 156 | ||
157 | def check_git_repo(): | ||
158 | """Checks that the .git directory exists inside QMK_HOME. | ||
159 | |||
160 | This is a decent enough indicator that the qmk_firmware directory is a | ||
161 | proper Git repository, rather than a .zip download from GitHub. | ||
162 | """ | ||
163 | dot_git_dir = QMK_FIRMWARE / '.git' | ||
164 | |||
165 | return CheckStatus.OK if dot_git_dir.is_dir() else CheckStatus.WARNING | ||
166 | |||
167 | |||
157 | def check_udev_rules(): | 168 | def check_udev_rules(): |
158 | """Make sure the udev rules look good. | 169 | """Make sure the udev rules look good. |
159 | """ | 170 | """ |
@@ -338,6 +349,13 @@ def doctor(cli): | |||
338 | 349 | ||
339 | cli.log.info('QMK home: {fg_cyan}%s', QMK_FIRMWARE) | 350 | cli.log.info('QMK home: {fg_cyan}%s', QMK_FIRMWARE) |
340 | 351 | ||
352 | # Make sure our QMK home is a Git repo | ||
353 | git_ok = check_git_repo() | ||
354 | |||
355 | if git_ok == CheckStatus.WARNING: | ||
356 | cli.log.warning("QMK home does not appear to be a Git repository! (no .git folder)") | ||
357 | status = CheckStatus.WARNING | ||
358 | |||
341 | # Make sure the basic CLI tools we need are available and can be executed. | 359 | # Make sure the basic CLI tools we need are available and can be executed. |
342 | bin_ok = check_binaries() | 360 | bin_ok = check_binaries() |
343 | 361 | ||