]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ls-tree: `-l` should not imply recursive listing
authorJosh Steadmon <steadmon@google.com>
Mon, 4 Apr 2022 22:42:24 +0000 (15:42 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Apr 2022 15:41:25 +0000 (08:41 -0700)
In 9c4d58ff2c (ls-tree: split up "fast path" callbacks, 2022-03-23), a
refactoring of the various read_tree_at() callbacks caused us to
unconditionally recurse into directories if `-l` (long format) was
passed on the command line, regardless of whether or not we also pass
the `-r` (recursive) flag.

Fix this by making show_tree_long() return the value of `recurse`,
rather than always returning 1. This value is interpreted by
read_tree_at() to be a signal on whether or not to recurse.

Signed-off-by: Josh Steadmon <steadmon@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/ls-tree.c

index 44a91cf9d05564f26d4a5fd18ab80d4f42e4a546..696d94b8b83152de5d2d4ad396c0c70658b3a20e 100644 (file)
@@ -255,7 +255,7 @@ static int show_tree_long(const struct object_id *oid, struct strbuf *base,
        printf("%06o %s %s %7s\t", data.mode, type_name(data.type),
               find_unique_abbrev(data.oid, abbrev), size_text);
        show_tree_common_default_long(base, pathname, data.base->len);
-       return 1;
+       return recurse;
 }
 
 static int show_tree_name_only(const struct object_id *oid, struct strbuf *base,