[PATCH v3 5/5] test-lib-functions.sh: remove unused [de]packetize() functions
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 14, 2021, 00:54 UTC
- Message-ID
- <patch-5.5-7ca83c5a55-20210714T005115Z-avarab@gmail.com>
- In-Reply-To
- <cover-0.5-0000000000-20210714T005115Z-avarab@gmail.com>
Remove the now-unused "packetize()" and "depacketize()" functions added in 4414a150025 (t/lib-git-daemon: add network-protocol helpers, 2018-01-24). As discussed in the preceding commits we've now moved all their users over to "test-tool pkt-line".
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- t/test-lib-functions.sh | 42 ----------------------------------------- 1 file changed, 42 deletions(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index b2810478a2..77e4434dcd 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -1453,48 +1453,6 @@ nongit () { ) } 7>&2 2>&4 -# convert function arguments or stdin (if not arguments given) to pktline -# representation. If multiple arguments are given, they are separated by -# whitespace and put in a single packet. Note that data containing NULs must be -# given on stdin, and that empty input becomes an empty packet, not a flush -# packet (for that you can just print 0000 yourself). -packetize () { - if test $# -gt 0 - then - packet="$*" - printf '%04x%s' "$((4 + ${#packet}))" "$packet" - else - perl -e ' - my $packet = do { local $/; <STDIN> }; - printf "%04x%s", 4 + length($packet), $packet; - ' - fi -} - -# Parse the input as a series of pktlines, writing the result to stdout. -# Sideband markers are removed automatically, and the output is routed to -# stderr if appropriate. -# -# NUL bytes are converted to "\\0" for ease of parsing with text tools. -depacketize () { - perl -e ' - while (read(STDIN, $len, 4) == 4) { - if ($len eq "0000") { - print "FLUSH\n"; - } else { - read(STDIN, $buf, hex($len) - 4); - $buf =~ s/\0/\\0/g; - if ($buf =~ s/^[\x2\x3]//) { - print STDERR $buf; - } else { - $buf =~ s/^\x1//; - print $buf; - } - } - } - ' -} - # Converts base-16 data into base-8. The output is given as a sequence of # escaped octals, suitable for consumption by 'printf'. hex2oct () {
-- 2.32.0.788.ge724008458