Skip to content

Commit 1e4ffc7

Browse files
dschogitster
authored andcommitted
t3701: adjust difffilter test
In 42f7d45 (add--interactive: detect bogus diffFilter output, 2018-03-03), we added a test case that verifies that the diffFilter feature complains appropriately when the output is too short. In preparation for the upcoming change where the built-in `add -p` is taught to respect that setting, let's adjust that test a little. The problem is that `echo too-short` is configured as diffFilter, and it does not read the `stdin`. When calling it through `pipe_command()`, it is therefore possible that we try to feed the `diff` to it while it is no longer listening, and we receive a `SIGPIPE`. The Perl code apparently handles this in a way similar to an end-of-file, but taking a step back, we realize that a diffFilter that does not even _look_ at its standard input is very unrealistic. The entire point of this feature is to transform the diff, not to ignore it altogether. So let's modify the test case to reflect that insight: instead of printing some bogus text, let's use a diffFilter that deletes the first line of the diff instead. This still tests for the same thing, but it does not confuse the built-in `add -p` with that `SIGPIPE`. Helped-by: SZEDER Gábor <[email protected]> Helped-by: Jeff King <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c480eeb commit 1e4ffc7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t3701-add-interactive.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ test_expect_success 'detect bogus diffFilter output' '
561561
git reset --hard &&
562562
563563
echo content >test &&
564-
test_config interactive.diffFilter "echo too-short" &&
564+
test_config interactive.diffFilter "sed 1d" &&
565565
printf y >y &&
566566
test_must_fail force_color git add -p <y
567567
'

0 commit comments

Comments
 (0)