mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Use exclusion syntax for git diff filtering
Since git 1.8.5 [1], '--diff-filter' can take lowercase args to mean "show everything but these classes". Use this to exclude deleted files rather than specify every other class. [1] https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/RelNotes/1.8.5.txt#n186
This commit is contained in:
parent
d7b189ce56
commit
f7cad33518
1 changed files with 1 additions and 2 deletions
|
|
@ -127,8 +127,7 @@ def get_staged_files(cwd: Optional[str] = None) -> List[str]:
|
||||||
return zsplit(
|
return zsplit(
|
||||||
cmd_output(
|
cmd_output(
|
||||||
'git', 'diff', '--staged', '--name-only', '--no-ext-diff', '-z',
|
'git', 'diff', '--staged', '--name-only', '--no-ext-diff', '-z',
|
||||||
# Everything except for D
|
'--diff-filter=d',
|
||||||
'--diff-filter=ACMRTUXB',
|
|
||||||
cwd=cwd,
|
cwd=cwd,
|
||||||
)[1],
|
)[1],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue