summaryrefslogtreecommitdiff
path: root/t/t3701-add-interactive.sh
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-03-03 00:58:49 -0500
committerJunio C Hamano <gitster@pobox.com>2018-03-05 12:49:45 -0800
commit42f7d45428e260acf535ba0d55ecc91ee81e21da (patch)
treec2f3d0af9f1037c0f97bcaaa1c178caaeea43ffa /t/t3701-add-interactive.sh
parentaf3570ed6ca97605d62ebe1836fc893014ae844b (diff)
downloadgit-42f7d45428e260acf535ba0d55ecc91ee81e21da.tar.gz
add--interactive: detect bogus diffFilter outputjk/add-i-diff-filter
It's important that the diff-filter only filter the individual lines, and that there remain a one-to-one mapping between the input and output lines. Otherwise, things like hunk-splitting will behave quite unexpectedly (e.g., you think you are splitting at one point, but it has a different effect in the text patch we apply). We can't detect all problematic cases, but we can at least catch the obvious case where we don't even have the correct number of lines. 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.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh
index 64fe56c3d5..9bb17f91b2 100755
--- a/t/t3701-add-interactive.sh
+++ b/t/t3701-add-interactive.sh
@@ -404,6 +404,14 @@ test_expect_success TTY 'diffFilter filters diff' '
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 &&