Merge branch 'jk/all-negative-diff-filter-fix'

A diff-filter with negative-only specification like "git log
--diff-filter=d" did not trigger correctly, which has been fixed.

* jk/all-negative-diff-filter-fix:
  setup_revisions(): turn on diffs for all-negative diff filter
maint
Junio C Hamano 2025-07-14 11:19:24 -07:00
commit 50d9c342b4
2 changed files with 7 additions and 1 deletions

View File

@ -3112,7 +3112,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s


/* Pickaxe, diff-filter and rename following need diffs */ /* Pickaxe, diff-filter and rename following need diffs */
if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) || if ((revs->diffopt.pickaxe_opts & DIFF_PICKAXE_KINDS_MASK) ||
revs->diffopt.filter || revs->diffopt.filter || revs->diffopt.filter_not ||
revs->diffopt.flags.follow_renames) revs->diffopt.flags.follow_renames)
revs->diff = 1; revs->diff = 1;



View File

@ -134,6 +134,12 @@ test_expect_success 'diff-filter=D' '


' '


test_expect_success 'all-negative filter' '
git log --no-renames --format=%s --diff-filter=d HEAD >actual &&
printf "%s\n" fifth fourth third second initial >expect &&
test_cmp expect actual
'

test_expect_success 'diff-filter=R' ' test_expect_success 'diff-filter=R' '


git log -M --pretty="format:%s" --diff-filter=R HEAD >actual && git log -M --pretty="format:%s" --diff-filter=R HEAD >actual &&