Hi Han-Wen, On Thu, 1 Oct 2020, Han-Wen Nienhuys via GitGitGadget wrote: > From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx> > > This will be further split up once preceding commits have passed review. Before you further split it up, I encourage you to include these patches without which the CI builds will continue to fail (Junio, could I ask you to either cherry-pick them from https://github.com/git-for-windows/git's shears/seen branch, or apply them from the mbox?): -- snipsnap -- >From e485e006f34922439f2e971a1c5c38b8ca56c011 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin <johannes.schindelin@xxxxxx> Date: Wed, 30 Sep 2020 14:46:59 +0200 Subject: [PATCH 1/3] fixup??? reftable: rest of library struct abc x = {} is a GNUism. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- reftable/dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reftable/dump.c b/reftable/dump.c index ed09f2e2f94..233f0434e39 100644 --- a/reftable/dump.c +++ b/reftable/dump.c @@ -75,7 +75,7 @@ static int dump_table(const char *tablename) static int compact_stack(const char *stackdir) { struct reftable_stack *stack = NULL; - struct reftable_write_options cfg = {}; + struct reftable_write_options cfg = { 0 }; int err = reftable_new_stack(&stack, stackdir, cfg); if (err < 0) @@ -94,7 +94,7 @@ static int compact_stack(const char *stackdir) static int dump_stack(const char *stackdir) { struct reftable_stack *stack = NULL; - struct reftable_write_options cfg = {}; + struct reftable_write_options cfg = { 0 }; struct reftable_iterator it = { NULL }; struct reftable_ref_record ref = { NULL }; struct reftable_log_record log = { NULL }; -- 2.28.0.windows.1.18.g5300e52e185 >From d5faa818a1bc00016e310d27602551127db620fb Mon Sep 17 00:00:00 2001 From: Johannes Schindelin <johannes.schindelin@xxxxxx> Date: Wed, 30 Sep 2020 14:55:28 +0200 Subject: [PATCH 2/3] fixup??? reftable: rest of library 0-sized arrays are actually not portable. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- reftable/stack_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reftable/stack_test.c b/reftable/stack_test.c index 534463829cb..e863cc3c0a2 100644 --- a/reftable/stack_test.c +++ b/reftable/stack_test.c @@ -572,11 +572,11 @@ static void test_sizes_to_segments(void) static void test_sizes_to_segments_empty(void) { - uint64_t sizes[0]; + uint64_t sizes[1]; int seglen = 0; struct segment *segs = - sizes_to_segments(&seglen, sizes, ARRAY_SIZE(sizes)); + sizes_to_segments(&seglen, sizes, 0); assert(seglen == 0); reftable_free(segs); } -- 2.28.0.windows.1.18.g5300e52e185 >From d446e1a7354c676d60114b50ba96a6ea083441ae Mon Sep 17 00:00:00 2001 From: Johannes Schindelin <johannes.schindelin@xxxxxx> Date: Wed, 30 Sep 2020 15:19:28 +0200 Subject: [PATCH 3/3] fixup??? reftable: rest of library Avoid using `getopt()`: it might be POSIX, but Git's audience is much larger than POSIX. MSVC, for example, does not support `getopt()`. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- reftable/dump.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/reftable/dump.c b/reftable/dump.c index 233f0434e39..b63c9fe9e81 100644 --- a/reftable/dump.c +++ b/reftable/dump.c @@ -160,40 +160,34 @@ static void print_help(void) int reftable_dump_main(int argc, char *const *argv) { int err = 0; - int opt; int opt_dump_table = 0; int opt_dump_stack = 0; int opt_compact = 0; - const char *arg = NULL; - while ((opt = getopt(argc, argv, "2chts")) != -1) { - switch (opt) { - case '2': - hash_id = 0x73323536; + const char *arg = NULL, *argv0 = argv[0]; + + for (; argc > 1; argv++, argc--) + if (*argv[1] != '-') break; - case 't': + else if (!strcmp("-2", argv[1])) + hash_id = 0x73323536; + else if (!strcmp("-t", argv[1])) opt_dump_table = 1; - break; - case 's': + else if (!strcmp("-s", argv[1])) opt_dump_stack = 1; - break; - case 'c': + else if (!strcmp("-c", argv[1])) opt_compact = 1; - break; - case '?': - case 'h': + else if (!strcmp("-?", argv[1]) || !strcmp("-h", argv[1])) { print_help(); return 2; - break; } - } - if (argv[optind] == NULL) { + if (argc != 2) { fprintf(stderr, "need argument\n"); print_help(); return 2; } - arg = argv[optind]; + arg = argv[1]; if (opt_dump_table) { err = dump_table(arg); @@ -204,7 +198,7 @@ int reftable_dump_main(int argc, char *const *argv) } if (err < 0) { - fprintf(stderr, "%s: %s: %s\n", argv[0], arg, + fprintf(stderr, "%s: %s: %s\n", argv0, arg, reftable_error_str(err)); return 1; } -- 2.28.0.windows.1.18.g5300e52e185