Skip to content

Commit af3570e

Browse files
peffgitster
authored andcommitted
t3701: add a test for interactive.diffFilter
This feature was added in 0114384 (add--interactive: allow custom diff highlighting programs, 2016-02-27) but never tested. Let's add a basic test. Note that we only apply the filter when color is enabled, so we have to use test_terminal. This is an open limitation explicitly mentioned in the original commit. So take this commit as testing the status quo, and not making a statement on whether we'd want to enhance that in the future. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38e79b1 commit af3570e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/t3701-add-interactive.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,18 @@ test_expect_success TTY 'diffs can be colorized' '
392392
grep "$(printf "\\033")" output
393393
'
394394

395+
test_expect_success TTY 'diffFilter filters diff' '
396+
git reset --hard &&
397+
398+
echo content >test &&
399+
test_config interactive.diffFilter "sed s/^/foo:/" &&
400+
printf y | test_terminal git add -p >output 2>&1 &&
401+
402+
# avoid depending on the exact coloring or content of the prompts,
403+
# and just make sure we saw our diff prefixed
404+
grep foo:.*content output
405+
'
406+
395407
test_expect_success 'patch-mode via -i prompts for files' '
396408
git reset --hard &&
397409

0 commit comments

Comments
 (0)