From e13d1a84751a575a8f2b1827e1fba66fa8fd7a9e Mon Sep 17 00:00:00 2001 From: Colin Dean Date: Fri, 17 Dec 2021 11:01:58 -0500 Subject: [PATCH] Simplifies diff-filter for modified files except deletes This comes by recommendation of @newren in the thread related to #221. I could only see this being regrettable if a new filter type was added that Peru doesn't want. I speculate that such is unlikely so this is probably safe. [1]: https://lore.kernel.org/git/CABPp-BEZj4opBu+wo2whOCHrck1qMjZXfDY9tAE5FbB=Wr9F_w@mail.gmail.com/ --- peru/cache.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/peru/cache.py b/peru/cache.py index 7f1174c..fad9425 100644 --- a/peru/cache.py +++ b/peru/cache.py @@ -154,10 +154,11 @@ async def working_copy_matches_index(self): return len(diff_output) == 0 async def get_modified_files_skipping_deletes(self): - # We want to ignore deleted files, so we include every possible value - # of --diff-filter except 'D'. + # We want to ignore deleted files, so we exclude only deletes using + # 'd' instead of including all of the capital letter forms. + # https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203 diff_output = await self.git('diff-files', '-z', '--name-only', - '--diff-filter=ACMRTUXB') + '--diff-filter=d') return [name for name in diff_output.split('\x00') if name] async def get_new_files_in_tree(self, previous_tree, new_tree):