Commits

Ian Cordasco committed a91b60a

Add lazy option to the git_hook.

Comments (0)

Files changed (1)

             [line.strip() for line in p.stderr.readlines()])
 
 
-def git_hook(complexity=-1, strict=False, ignore=None):
+def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
     _initpep8()
     if ignore:
         pep8.options.ignore = ignore
 
     warnings = 0
 
-    _, files_modified, _ = run("git diff-index --cached --name-only HEAD")
+    gitcmd = "git diff-index --cached --name-only HEAD"
+    if lazy:
+        gitcmd = gitcmd.replace('--cached ', '')
+
+    _, files_modified, _ = run(gitcmd)
     for filename in files_modified:
         ext = os.path.splitext(filename)[-1]
         if ext != '.py':