[PATCH] Skip checks on files that are not staged for commit.

David Shea dshea at redhat.com
Fri Dec 13 15:01:09 UTC 2013


This keeps the pylint hook from complaining about files that aren't
actually being committed.
---
 scripts/githooks/pre-commit | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/githooks/pre-commit b/scripts/githooks/pre-commit
index 501a9c3..5704b28 100755
--- a/scripts/githooks/pre-commit
+++ b/scripts/githooks/pre-commit
@@ -39,8 +39,9 @@ pylint_files = []
 # The first character is the status in the index (or our side of a merge),
 # the second character is the status in the tree (or their side of a merge).
 for gf in git_files.splitlines():
-    # If the file is being removed or is not in git, ignore it
-    if gf[0] in ('D', '?'):
+    # If the file is being removed, or is not in git, or is not part of this
+    # commit, ignore it
+    if gf[0] in ('D', '?', ' '):
         continue
     # If the file is being renamed, grab the target filename
     if gf[0] == 'R':
-- 
1.8.4.2



More information about the anaconda-patches mailing list