git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 08/10] reftable/dump: drop unused printing functionality

From
karthik nayak <karthik.188@gmail.com>
Date
Aug 13, 2024, 10:14 UTC
Message-ID
<CAOLa=ZScKRvAWsa4D+_BCyAbxQ9580RBnJ+==DfCvrGV6C2ETg@mail.gmail.com>
In-Reply-To
<1f211e514d049379ada609e6a4e8cf985e721271.1723528765.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 54 quoted lines
> We have a bunch of infrastructure wired up that allows us to print
> reftable records, tables and stacks. While this functionality is wired
> up via various "test-tool reftable" options, it is never used. It also
> feels kind of dubious whether any other eventual user of the reftable
> library should use it as it very much feels like a debugging aid rather
> than something sensible. The format itself is somewhat inscrutable and
> the infrastructure is non-extensible.
>
> Drop this code. The only remaining function in this context is
> `reftable_reader_print_blocks()`, which we do use in our tests.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  reftable/dump.c             |  16 +----
>  reftable/generic.c          |  47 -------------
>  reftable/reader.c           |  21 ------
>  reftable/record.c           | 127 ------------------------------------
>  reftable/record.h           |   4 --
>  reftable/reftable-generic.h |   3 -
>  reftable/reftable-reader.h  |   2 -
>  reftable/reftable-record.h  |   8 ---
>  reftable/reftable-stack.h   |   3 -
>  reftable/stack.c            |  20 ------
>  reftable/stack_test.c       |   7 --
>  11 files changed, 1 insertion(+), 257 deletions(-)
>
> diff --git a/reftable/dump.c b/reftable/dump.c
> index 2953e0a83a..35a1731da9 100644
> --- a/reftable/dump.c
> +++ b/reftable/dump.c
> @@ -41,9 +41,6 @@ int reftable_dump_main(int argc, char *const *argv)
>  {
>  	int err = 0;
>  	int opt_dump_blocks = 0;
> -	int opt_dump_table = 0;
> -	int opt_dump_stack = 0;
> -	uint32_t opt_hash_id = GIT_SHA1_FORMAT_ID;
>  	const char *arg = NULL, *argv0 = argv[0];
>
>  	for (; argc > 1; argv++, argc--)
> @@ -51,12 +48,6 @@ int reftable_dump_main(int argc, char *const *argv)
>  			break;
>  		else if (!strcmp("-b", argv[1]))
>  			opt_dump_blocks = 1;
> -		else if (!strcmp("-t", argv[1]))
> -			opt_dump_table = 1;
> -		else if (!strcmp("-6", argv[1]))
> -			opt_hash_id = GIT_SHA256_FORMAT_ID;
> -		else if (!strcmp("-s", argv[1]))
> -			opt_dump_stack = 1;
>  		else if (!strcmp("-?", argv[1]) || !strcmp("-h", argv[1])) {
>  			print_help();
>  			return 2;
> @@ -70,13 +61,8 @@ int reftable_dump_main(int argc, char *const *argv)

I'm a bit skeptical about this change because I definitely have used the `-t` and `-s` options a bunch of times to understand what a table holds. Since the reftable format is binary, this is the only tooling we have which allows us to read this format from a plumbing point of view. I'd keep them. I guess the stack printing just iterates over the tables and prints them and could be removed, but I'd keep the option to dump a table.

Also this patch misses cleaning up `print_help` if we go down this route.

[snip]
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 21 of 25 in “reftable: drop generic `reftable_table` interface”
  1. 00/10 reftable: drop generic `reftable_table` interfacePatrick Steinhardt, Aug 13, 2024
  2. 01/10 reftable/merged: expose functions to initialize iteratorsPatrick Steinhardt, Aug 13, 2024
  3. karthik nayakAug 13, 2024
  4. Patrick SteinhardtAug 14, 2024
  5. Justin ToblerAug 19, 2024
  6. Patrick SteinhardtAug 20, 2024
  7. 02/10 reftable/merged: rename `reftable_new_merged_table()`Patrick Steinhardt, Aug 13, 2024
  8. 03/10 reftable/merged: stop using generic tables in the merged tablePatrick Steinhardt, Aug 13, 2024
  9. karthik nayakAug 13, 2024
  10. Justin ToblerAug 19, 2024
  11. 04/10 reftable/stack: open-code reading refsPatrick Steinhardt, Aug 13, 2024
  12. 05/10 reftable/iter: drop double-checking logicPatrick Steinhardt, Aug 13, 2024
  13. Eric SunshineAug 13, 2024
  14. 06/10 reftable/generic: move generic iterator code into iterator interfacePatrick Steinhardt, Aug 13, 2024
  15. karthik nayakAug 13, 2024
  16. Patrick SteinhardtAug 14, 2024
  17. Junio C HamanoAug 14, 2024
  18. karthik nayakAug 15, 2024
  19. 07/10 reftable/dump: drop unused `compact_stack()`Patrick Steinhardt, Aug 13, 2024
  20. 08/10 reftable/dump: drop unused printing functionalityPatrick Steinhardt, Aug 13, 2024
  21. karthik nayakAug 13, 2024
  22. Patrick SteinhardtAug 14, 2024
  23. 09/10 reftable/dump: move code into "t/helper/test-reftable.c"Patrick Steinhardt, Aug 13, 2024
  24. 10/10 reftable/generic: drop interfacePatrick Steinhardt, Aug 13, 2024
  25. karthik nayakAug 13, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.