diff options
author | Vincent Ambo <mail@tazj.in> | 2021-09-21T10·03+0300 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2021-09-21T11·29+0300 |
commit | 43b1791ec601732ac31195df96781a848360a9ac (patch) | |
tree | daae8d638343295d2f1f7da955e556ef4c958864 /third_party/git/t/helper/test-pkt-line.c | |
parent | 2d8e7dc9d9c38127ec4ebd13aee8e8f586a43318 (diff) |
chore(3p/git): Unvendor git and track patches instead r/2903
This was vendored a long time ago under the expectation that keeping it in sync with cgit would be easier this way, but it has proven not to be a big issue. On the other hand, a vendored copy of git is an annoying maintenance burden. It is much easier to rebase the single (dottime) patch that we have. This removes the vendored copy of git and instead passes the git source code to cgit via `pkgs.srcOnly`, which includes the applied patch so that cgit can continue rendering dottime. Change-Id: If31f62dea7ce688fd1b9050204e9378019775f2b
Diffstat (limited to 'third_party/git/t/helper/test-pkt-line.c')
-rw-r--r-- | third_party/git/t/helper/test-pkt-line.c | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/third_party/git/t/helper/test-pkt-line.c b/third_party/git/t/helper/test-pkt-line.c deleted file mode 100644 index 69152958e58e..000000000000 --- a/third_party/git/t/helper/test-pkt-line.c +++ /dev/null @@ -1,102 +0,0 @@ -#include "cache.h" -#include "test-tool.h" -#include "pkt-line.h" - -static void pack_line(const char *line) -{ - if (!strcmp(line, "0000") || !strcmp(line, "0000\n")) - packet_flush(1); - else if (!strcmp(line, "0001") || !strcmp(line, "0001\n")) - packet_delim(1); - else - packet_write_fmt(1, "%s", line); -} - -static void pack(int argc, const char **argv) -{ - if (argc) { /* read from argv */ - int i; - for (i = 0; i < argc; i++) - pack_line(argv[i]); - } else { /* read from stdin */ - char line[LARGE_PACKET_MAX]; - while (fgets(line, sizeof(line), stdin)) { - pack_line(line); - } - } -} - -static void unpack(void) -{ - struct packet_reader reader; - packet_reader_init(&reader, 0, NULL, 0, - PACKET_READ_GENTLE_ON_EOF | - PACKET_READ_CHOMP_NEWLINE); - - while (packet_reader_read(&reader) != PACKET_READ_EOF) { - switch (reader.status) { - case PACKET_READ_EOF: - break; - case PACKET_READ_NORMAL: - printf("%s\n", reader.line); - break; - case PACKET_READ_FLUSH: - printf("0000\n"); - break; - case PACKET_READ_DELIM: - printf("0001\n"); - break; - case PACKET_READ_RESPONSE_END: - printf("0002\n"); - break; - } - } -} - -static void unpack_sideband(void) -{ - struct packet_reader reader; - packet_reader_init(&reader, 0, NULL, 0, - PACKET_READ_GENTLE_ON_EOF | - PACKET_READ_CHOMP_NEWLINE); - - while (packet_reader_read(&reader) != PACKET_READ_EOF) { - int band; - int fd; - - switch (reader.status) { - case PACKET_READ_EOF: - break; - case PACKET_READ_NORMAL: - band = reader.line[0] & 0xff; - if (band < 1 || band > 2) - continue; /* skip non-sideband packets */ - fd = band; - - write_or_die(fd, reader.line + 1, reader.pktlen - 1); - break; - case PACKET_READ_FLUSH: - return; - case PACKET_READ_DELIM: - case PACKET_READ_RESPONSE_END: - break; - } - } -} - -int cmd__pkt_line(int argc, const char **argv) -{ - if (argc < 2) - die("too few arguments"); - - if (!strcmp(argv[1], "pack")) - pack(argc - 2, argv + 2); - else if (!strcmp(argv[1], "unpack")) - unpack(); - else if (!strcmp(argv[1], "unpack-sideband")) - unpack_sideband(); - else - die("invalid argument '%s'", argv[1]); - - return 0; -} |