[PATCH] Don't crash in pre-commit if no files changed

David Shea dshea at redhat.com
Tue Dec 9 20:05:49 UTC 2014


---
 scripts/githooks/pre-commit | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/githooks/pre-commit b/scripts/githooks/pre-commit
index 124eb88..82dccb4 100755
--- a/scripts/githooks/pre-commit
+++ b/scripts/githooks/pre-commit
@@ -35,6 +35,10 @@ try:
 except CalledProcessError:
     sys.exit(1)
 
+# If git status returned nothing, return
+if not git_files:
+    sys.exit(0)
+
 git_files = git_files.strip('\0').split('\0')
 
 pylint_names = []
-- 
2.1.0



More information about the anaconda-patches mailing list