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:
Matthew Hughes 2021-02-23 21:36:41 +00:00
parent d7b189ce56
commit f7cad33518

View file

@ -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],
) )