summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-10-24 18:29:45 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-10-25 05:25:44 -0500
commit941896218d477c3ec117d21dc9da45d4265269b8 (patch)
tree83c3b3e660316246eb6187ac9e7eb113b9e9f338 /src
parent0285359a1418def10b4dbd3c94af7855bad54eca (diff)
downloadflake8-941896218d477c3ec117d21dc9da45d4265269b8.tar.gz
Change how we apply lazy to the git hook
Diffstat (limited to 'src')
-rw-r--r--src/flake8/main/git.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/flake8/main/git.py b/src/flake8/main/git.py
index 642ff38..d0c87d3 100644
--- a/src/flake8/main/git.py
+++ b/src/flake8/main/git.py
@@ -140,11 +140,14 @@ def make_temporary_directory_from(destination, directory):
def find_modified_files(lazy):
- diff_index = piped_process(
- ['git', 'diff-index', '' if lazy else '--cached', '--name-only',
- '--diff-filter=ACMRTUXB', 'HEAD'],
- )
-
+ diff_index_cmd = [
+ 'git', 'diff-index', '--cached', '--name-only',
+ '--diff-filter=ACMRTUXB', 'HEAD'
+ ]
+ if lazy:
+ diff_index_cmd.remove('--cached')
+
+ diff_index = piped_process(diff_index_cmd)
(stdout, _) = diff_index.communicate()
stdout = to_text(stdout)
return stdout.splitlines()