diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-07-28 13:18:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-07-28 13:18:00 -0700 |
commit | 5bae9272220ce25d170e35c3cb84bcc110685363 (patch) | |
tree | 1b3b5b8f41e70f7927fe51369b899aefad9f9bda /t/helper/test-pkt-line.c | |
parent | Merge branch 'jk/t0000-subtests-fix' (diff) | |
parent | test-lib-functions: use test-tool for [de]packetize() (diff) | |
download | tgif-5bae9272220ce25d170e35c3cb84bcc110685363.tar.xz |
Merge branch 'ab/pkt-line-tests'
Tests that cover protocol bits have been updated and helpers
used there have been consolidated.
* ab/pkt-line-tests:
test-lib-functions: use test-tool for [de]packetize()
Diffstat (limited to 't/helper/test-pkt-line.c')
-rw-r--r-- | t/helper/test-pkt-line.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/t/helper/test-pkt-line.c b/t/helper/test-pkt-line.c index 5e638f0b97..c5e052e537 100644 --- a/t/helper/test-pkt-line.c +++ b/t/helper/test-pkt-line.c @@ -26,6 +26,16 @@ static void pack(int argc, const char **argv) } } +static void pack_raw_stdin(void) +{ + struct strbuf sb = STRBUF_INIT; + + if (strbuf_read(&sb, 0, 0) < 0) + die_errno("failed to read from stdin"); + packet_write(1, sb.buf, sb.len); + strbuf_release(&sb); +} + static void unpack(void) { struct packet_reader reader; @@ -110,6 +120,8 @@ int cmd__pkt_line(int argc, const char **argv) if (!strcmp(argv[1], "pack")) pack(argc - 2, argv + 2); + else if (!strcmp(argv[1], "pack-raw-stdin")) + pack_raw_stdin(); else if (!strcmp(argv[1], "unpack")) unpack(); else if (!strcmp(argv[1], "unpack-sideband")) |