run_checks: Also check for uncommited changes.

This commit is contained in:
Florian Bruhin 2014-12-05 23:29:49 +01:00
parent 57d566d1a6
commit acb058dc2b

View File

@ -129,18 +129,24 @@ def check_git():
print() print()
return False return False
untracked = [] untracked = []
changed = []
gitst = subprocess.check_output(['git', 'status', '--porcelain']) gitst = subprocess.check_output(['git', 'status', '--porcelain'])
gitst = gitst.decode('UTF-8').strip() gitst = gitst.decode('UTF-8').strip()
for line in gitst.splitlines(): for line in gitst.splitlines():
s, name = line.split(maxsplit=1) s, name = line.split(maxsplit=1)
if s == '??': if s == '??':
untracked.append(name) untracked.append(name)
elif s == 'M':
changed.append(name)
status = True
if untracked: if untracked:
status = False status = False
utils.print_col("Untracked files:", 'red') utils.print_col("Untracked files:", 'red')
print('\n'.join(untracked)) print('\n'.join(untracked))
else: if changed:
status = True status = False
utils.print_col("Uncommited changes:", 'red')
print('\n'.join(changed))
print() print()
return status return status