summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-03-03 05:58:10 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-05 20:49:43 (GMT)
commitaf3570ed6ca97605d62ebe1836fc893014ae844b (patch)
tree7a9c267d41f089ff5d3a56703835007c429e3f4e /t/t3701-add-interactive.sh
parent38e79b1fdab9244e1727d0698afcf3bb8956c0a4 (diff)
downloadgit-af3570ed6ca97605d62ebe1836fc893014ae844b.zip
git-af3570ed6ca97605d62ebe1836fc893014ae844b.tar.gz
git-af3570ed6ca97605d62ebe1836fc893014ae844b.tar.bz2
t3701: add a test for interactive.diffFilter
This feature was added in 01143847db (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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 058698d..64fe56c 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -392,6 +392,18 @@ test_expect_success TTY 'diffs can be colorized' '
grep "$(printf "\\033")" output
'
+test_expect_success TTY 'diffFilter filters diff' '
+ git reset --hard &&
+
+ echo content >test &&
+ test_config interactive.diffFilter "sed s/^/foo:/" &&
+ printf y | test_terminal git add -p >output 2>&1 &&
+
+ # avoid depending on the exact coloring or content of the prompts,
+ # and just make sure we saw our diff prefixed
+ grep foo:.*content output
+'
+
test_expect_success 'patch-mode via -i prompts for files' '
git reset --hard &&