Thread (1 message) 1 message, 1 author, 2023-07-07

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

From: Junio C Hamano <hidden>
Date: 2023-07-07 19:02:11

René Scharfe [off-list ref] writes:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help