aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-04-03 07:05:55 +0200
committerJunio C Hamano <gitster@pobox.com>2025-04-07 14:47:37 -0700
commit01486b5de886af06c5bbfb097736ec97b86bacda (patch)
treeb1f598517a9e08f52d7a5dc993f426ae6678014f
parent2df6710097cf7abe07e4e3b42955cc881ca7aa22 (diff)
downloadgit-01486b5de886af06c5bbfb097736ec97b86bacda.tar.gz
t: adapt `test_copy_bytes()` to not use Perl
The `test_copy_bytes()` helper function copies up to N bytes from stdin to stdout. This is implemented using Perl, but it can be trivially adapted to instead use dd(1). Refactor the helper accordingly, which allows a bunch of tests to pass when Perl is not available. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--t/test-lib-functions.sh12
1 files changed, 1 insertions, 11 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 377f08a142..c4b4d3a4c7 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -1640,17 +1640,7 @@ test_match_signal () {
# Read up to "$1" bytes (or to EOF) from stdin and write them to stdout.
test_copy_bytes () {
- perl -e '
- my $len = $ARGV[1];
- while ($len > 0) {
- my $s;
- my $nread = sysread(STDIN, $s, $len);
- die "cannot read: $!" unless defined($nread);
- last unless $nread;
- print $s;
- $len -= $nread;
- }
- ' - "$1"
+ dd ibs=1 count="$1" 2>/dev/null
}
# run "$@" inside a non-git directory