diff options
author | Patrick Steinhardt <ps@pks.im> | 2025-04-03 07:06:04 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-04-07 14:47:39 -0700 |
commit | 4a7af4edbb800ff8ed0cd131423f45c2c76e1200 (patch) | |
tree | de11e6515671a414ec048a079557685f72271cb0 /t/t7815-grep-binary.sh | |
parent | 6aec8d38fddf22fa9fd3194acc2b891d295b5fbc (diff) |
t: refactor tests depending on Perl for textconv scripts
We have a couple of tests that depend on Perl for textconv scripts.
Refactor these tests to instead be implemented via shell utilities so
that we can drop a couple of PERL_TEST_HELPERS prerequisites.
Note that the conversion in t4030 is not a one-to-one equivalent to the
previous textconv script. Before this change we used to essentially do a
hexdump via Perl. The obvious conversion here would be to use `test-tool
hexdump` like we do for the other tests. But this would lead to a ripple
effect where we would have to adapt a bunch of other tests with a bunch
of seemingly unrelated changes, which would be somewhat awkward.
Instead, we're going with the minimum viable change: the test files we
write contain "\001" and "\000", and the test's expectation is that
those get translated into proper ASCII characters. So instead of doing a
full hexdump, we simply use tr(1) to translate these specific bytes.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7815-grep-binary.sh')
-rwxr-xr-x | t/t7815-grep-binary.sh | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/t/t7815-grep-binary.sh b/t/t7815-grep-binary.sh index b2730d200c..3bd91da970 100755 --- a/t/t7815-grep-binary.sh +++ b/t/t7815-grep-binary.sh @@ -4,12 +4,6 @@ test_description='git grep in binary files' . ./test-lib.sh -if ! test_have_prereq PERL_TEST_HELPERS -then - skip_all='skipping grep binary tests; Perl not available' - test_done -fi - test_expect_success 'setup' " echo 'binaryQfileQm[*]cQ*æQð' | q_to_nul >a && git add a && @@ -120,13 +114,10 @@ test_expect_success 'grep respects not-binary diff attribute' ' test_cmp expect actual ' -cat >nul_to_q_textconv <<'EOF' -#!/bin/sh -"$PERL_PATH" -pe 'y/\000/Q/' < "$1" -EOF -chmod +x nul_to_q_textconv - test_expect_success 'setup textconv filters' ' + write_script nul_to_q_textconv <<-\EOF && + tr "\000" "Q" <"$1" + EOF echo a diff=foo >.gitattributes && git config diff.foo.textconv "\"$(pwd)\""/nul_to_q_textconv ' |