Merge branch 'ew/find-perl-on-freebsd-in-local'
[gitweb.git] / t / t9300-fast-import.sh
index 74d740de41bbd489dd0ce9fb811f9ea1c08b248c..2e0ba3ebd8ab3273144743dc38675e2b5d429ea1 100755 (executable)
@@ -7,23 +7,6 @@ test_description='test git fast-import utility'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
 
-# Print $1 bytes from stdin to stdout.
-#
-# This could be written as "head -c $1", but IRIX "head" does not
-# support the -c option.
-head_c () {
-       perl -e '
-               my $len = $ARGV[1];
-               while ($len > 0) {
-                       my $s;
-                       my $nread = sysread(STDIN, $s, $len);
-                       die "cannot read: $!" unless defined($nread);
-                       print $s;
-                       $len -= $nread;
-               }
-       ' - "$1"
-}
-
 verify_packs () {
        for p in .git/objects/pack/*.pack
        do
@@ -2481,7 +2464,7 @@ test_expect_success PIPE 'R: copy using cat-file' '
 
                read blob_id type size <&3 &&
                echo "$blob_id $type $size" >response &&
-               head_c $size >blob <&3 &&
+               test_copy_bytes $size >blob <&3 &&
                read newline <&3 &&
 
                cat <<-EOF &&
@@ -2524,7 +2507,7 @@ test_expect_success PIPE 'R: print blob mid-commit' '
                EOF
 
                read blob_id type size <&3 &&
-               head_c $size >actual <&3 &&
+               test_copy_bytes $size >actual <&3 &&
                read newline <&3 &&
 
                echo
@@ -2559,7 +2542,7 @@ test_expect_success PIPE 'R: print staged blob within commit' '
                echo "cat-blob $to_get" &&
 
                read blob_id type size <&3 &&
-               head_c $size >actual <&3 &&
+               test_copy_bytes $size >actual <&3 &&
                read newline <&3 &&
 
                echo deleteall