reftable/dump: drop unused `compact_stack()`

The `compact_stack()` function is exposed via `reftable_dump_main()`, which ultimately ends up being wired into "test-tool reftable". It is never used by our tests though, and nowadays we have wired up support for stack compaction into git-pack-refs(1). Remove the code. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Patrick Steinhardt committed Aug 22, 2024 at 08:35 UTC 55c7ff42f93159c7409bdd4caa59837baf482a05
1 file changed +1 -26
reftable/dump.c
+1 -26
@@ -24,30 +24,10 @@ https://developers.google.com/open-source/licenses/bsd
24 #include <unistd.h>
25 #include <string.h>
26
27 -static int compact_stack(const char *stackdir)
28 -{
29 - struct reftable_stack *stack = NULL;
30 - struct reftable_write_options opts = { 0 };
31 -
32 - int err = reftable_new_stack(&stack, stackdir, &opts);
33 - if (err < 0)
34 - goto done;
35 -
36 - err = reftable_stack_compact_all(stack, NULL);
37 - if (err < 0)
38 - goto done;
39 -done:
40 - if (stack) {
41 - reftable_stack_destroy(stack);
42 - }
43 - return err;
44 -}
45 -
27 static void print_help(void)
28 {
48 - printf("usage: dump [-cst] arg\n\n"
29 + printf("usage: dump [-st] arg\n\n"
30 "options: \n"
50 - " -c compact\n"
31 " -b dump blocks\n"
32 " -t dump table\n"
33 " -s dump stack\n"
@@ -62,7 +42,6 @@ int reftable_dump_main(int argc, char *const *argv)
42 int opt_dump_blocks = 0;
43 int opt_dump_table = 0;
44 int opt_dump_stack = 0;
65 - int opt_compact = 0;
45 uint32_t opt_hash_id = GIT_SHA1_FORMAT_ID;
46 const char *arg = NULL, *argv0 = argv[0];
47
@@ -77,8 +56,6 @@ int reftable_dump_main(int argc, char *const *argv)
56 opt_hash_id = GIT_SHA256_FORMAT_ID;
57 else if (!strcmp("-s", argv[1]))
58 opt_dump_stack = 1;
80 - else if (!strcmp("-c", argv[1]))
81 - opt_compact = 1;
59 else if (!strcmp("-?", argv[1]) || !strcmp("-h", argv[1])) {
60 print_help();
61 return 2;
@@ -98,8 +75,6 @@ int reftable_dump_main(int argc, char *const *argv)
75 err = reftable_reader_print_file(arg);
76 } else if (opt_dump_stack) {
77 err = reftable_stack_print_directory(arg, opt_hash_id);
101 - } else if (opt_compact) {
102 - err = compact_stack(arg);
78 }
79
80 if (err < 0) {