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

Re: [PATCH] ls-tree: simplify prefix handling

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 7, 2023, 19:01 UTC
Message-ID
<xmqqh6qf8s1w.fsf@gitster.g>
In-Reply-To
<b34aa99b-2bf1-c645-bdf5-03ac258b4bf5@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 5 quoted lines
> git ls-tree has two prefixes: The one handed to cmd_ls_tree(), i.e. the
> current subdirectory in the repository (if any) and the "display" prefix
> used by the show_tree_*() functions.  The option --full-name clears the
> last one, i.e. it shows full paths, and --full-tree clears both, i.e. it
> acts as if the command was started in the root of the repository.

Seeing "there are two" and then "the last one" made me come back to the beginning to see if I missed the third option, as I am not used to see the second one among two called "the last", even though it is logically correct. "clears the latter", perhaps, as "former vs latter" is sensible only when there are two, may have avoided my confusion, but that is minor.

> The show_tree_*() functions use the ls_tree_options members chomp_prefix
> and ls_tree_prefix to determine their prefix values.  Calculate it once
> in cmd_ls_tree() instead, once the main prefix value is finalized.
Very nice observation and simplification.
Thanks.
Previous: René Scharfe
Message 2 of 2 in “ls-tree: simplify prefix handling”
  1. ls-tree: simplify prefix handlingRené Scharfe, Jul 7, 2023
  2. Junio C HamanoJul 7, 2023

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.