t/lib-gpg: refactor sanitize_pgp() to not depend on Perl
The `sanitize_pgp()` test helper uses Perl to strip PGP signatures from stdin. Refactor it to instead use sed(1) so that we drop the PERL_TEST_HELPERS prerequisite in users of this library. Note that we have to add PERL_TEST_HELPERS to a subset of tests in t6300 now that the test suite doesn't bail out early anymore in case the prerequisite isn't set. Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4a7af4edbb
commit
3ca6f20585
@@ -192,9 +192,5 @@ test_lazy_prereq GPGSSH_VERIFYTIME '
|
|||||||
'
|
'
|
||||||
|
|
||||||
sanitize_pgp() {
|
sanitize_pgp() {
|
||||||
perl -ne '
|
sed "/^-----BEGIN PGP/,/^-----END PGP/{/^-/p;d;}"
|
||||||
/^-----END PGP/ and $in_pgp = 0;
|
|
||||||
print unless $in_pgp;
|
|
||||||
/^-----BEGIN PGP/ and $in_pgp = 1;
|
|
||||||
'
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,12 +10,6 @@ GNUPGHOME_NOT_USED=$GNUPGHOME
|
|||||||
. "$TEST_DIRECTORY"/lib-gpg.sh
|
. "$TEST_DIRECTORY"/lib-gpg.sh
|
||||||
. "$TEST_DIRECTORY"/lib-terminal.sh
|
. "$TEST_DIRECTORY"/lib-terminal.sh
|
||||||
|
|
||||||
if ! test_have_prereq PERL_TEST_HELPERS
|
|
||||||
then
|
|
||||||
skip_all='skipping for-each-ref tests; Perl not available'
|
|
||||||
test_done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Mon Jul 3 23:18:43 2006 +0000
|
# Mon Jul 3 23:18:43 2006 +0000
|
||||||
datestamp=1151968723
|
datestamp=1151968723
|
||||||
setdate_and_increment () {
|
setdate_and_increment () {
|
||||||
@@ -1215,7 +1209,7 @@ test_expect_success '%(raw) with --tcl must fail' '
|
|||||||
test_must_fail git for-each-ref --format="%(raw)" --tcl
|
test_must_fail git for-each-ref --format="%(raw)" --tcl
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success '%(raw) with --perl' '
|
test_expect_success PERL_TEST_HELPERS '%(raw) with --perl' '
|
||||||
git for-each-ref --format="\$name= %(raw);
|
git for-each-ref --format="\$name= %(raw);
|
||||||
print \"\$name\"" refs/myblobs/blob1 --perl | perl >actual &&
|
print \"\$name\"" refs/myblobs/blob1 --perl | perl >actual &&
|
||||||
cmp blob1 actual &&
|
cmp blob1 actual &&
|
||||||
@@ -1442,9 +1436,14 @@ test_expect_success 'set up trailers for next test' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_trailer_option () {
|
test_trailer_option () {
|
||||||
|
if test "$#" -eq 3
|
||||||
|
then
|
||||||
|
prereq="$1"
|
||||||
|
shift
|
||||||
|
fi &&
|
||||||
title=$1 option=$2
|
title=$1 option=$2
|
||||||
cat >expect
|
cat >expect
|
||||||
test_expect_success "$title" '
|
test_expect_success $prereq "$title" '
|
||||||
git for-each-ref --format="%($option)" refs/heads/main >actual &&
|
git for-each-ref --format="%($option)" refs/heads/main >actual &&
|
||||||
test_cmp expect actual &&
|
test_cmp expect actual &&
|
||||||
git for-each-ref --format="%(contents:$option)" refs/heads/main >actual &&
|
git for-each-ref --format="%(contents:$option)" refs/heads/main >actual &&
|
||||||
@@ -1452,7 +1451,7 @@ test_trailer_option () {
|
|||||||
'
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
test_trailer_option '%(trailers:unfold) unfolds trailers' \
|
test_trailer_option PERL_TEST_HELPERS '%(trailers:unfold) unfolds trailers' \
|
||||||
'trailers:unfold' <<-EOF
|
'trailers:unfold' <<-EOF
|
||||||
$(unfold <trailers)
|
$(unfold <trailers)
|
||||||
|
|
||||||
@@ -1482,13 +1481,13 @@ test_trailer_option '%(trailers:only=no) shows all trailers' \
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_trailer_option '%(trailers:only) and %(trailers:unfold) work together' \
|
test_trailer_option PERL_TEST_HELPERS '%(trailers:only) and %(trailers:unfold) work together' \
|
||||||
'trailers:only,unfold' <<-EOF
|
'trailers:only,unfold' <<-EOF
|
||||||
$(grep -v patch.description <trailers | unfold)
|
$(grep -v patch.description <trailers | unfold)
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
test_trailer_option '%(trailers:unfold) and %(trailers:only) work together' \
|
test_trailer_option PERL_TEST_HELPERS '%(trailers:unfold) and %(trailers:only) work together' \
|
||||||
'trailers:unfold,only' <<-EOF
|
'trailers:unfold,only' <<-EOF
|
||||||
$(grep -v patch.description <trailers | unfold)
|
$(grep -v patch.description <trailers | unfold)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user