summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2023-07-07 20:34:31 +0200
committerJunio C Hamano <gitster@pobox.com>2023-07-07 11:57:13 -0700
commit7b7203e78af7bfe431b9aadd7b726775ed442b3c (patch)
treeee8b53f2a7c26461e77d6f5a9c6137b40e87cc94 /diff.c
parent061c58647eb4b3f0e2c898333577d4b2af115b1d (diff)
ls-tree: simplify prefix handling
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. 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. This allows chomp_prefix to become a local variable. Stop using strlen(3) to determine its initial value -- we only care whether we got a non-empty string, not precisely how long it is. Rename ls_tree_prefix to prefix to demonstrate that we converted all users and because the ls_tree_ part is no longer necessary since 030a3d5d9e (ls-tree: use a "struct options", 2023-01-12) turned it from a global variable to a struct member. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions