summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-14 19:01:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 19:01:05 (GMT)
commitc5e2df04ac9dd731c729c6159d58c2288d794858 (patch)
treeb6db0972487a8a00694e6477deeea245888c6bf7 /t/t3701-add-interactive.sh
parentbd0f794342d5b3921f2d5d4bffce87ec7b7e4d96 (diff)
parent42f7d45428e260acf535ba0d55ecc91ee81e21da (diff)
downloadgit-c5e2df04ac9dd731c729c6159d58c2288d794858.zip
git-c5e2df04ac9dd731c729c6159d58c2288d794858.tar.gz
git-c5e2df04ac9dd731c729c6159d58c2288d794858.tar.bz2
Merge branch 'jk/add-i-diff-filter'
The "interactive.diffFilter" used by "git add -i" must retain one-to-one correspondence between its input and output, but it was not enforced and caused end-user confusion. We now at least make sure the filtered result has the same number of lines as its input to detect a broken filter. * jk/add-i-diff-filter: add--interactive: detect bogus diffFilter output t3701: add a test for interactive.diffFilter
Diffstat (limited to 't/t3701-add-interactive.sh')
-rwxr-xr-xt/t3701-add-interactive.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index a9a9478..b170fb0 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -397,6 +397,26 @@ 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 TTY 'detect bogus diffFilter output' '
+ git reset --hard &&
+
+ echo content >test &&
+ test_config interactive.diffFilter "echo too-short" &&
+ printf y | test_must_fail test_terminal git add -p
+'
+
test_expect_success 'patch-mode via -i prompts for files' '
git reset --hard &&