diff options
| author | René Scharfe <l.s.r@web.de> | 2023-01-14 15:37:53 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-01-14 19:22:26 -0800 |
| commit | 16fb5c54bd91c9714e12c6d742e5a6fd81459b71 (patch) | |
| tree | 0247f5b7dfa8a6ffa4bf13f7801ba420545da6f3 /git.c | |
| parent | ls-tree: introduce "--format" option (diff) | |
| download | git-16fb5c54bd91c9714e12c6d742e5a6fd81459b71.tar.gz git-16fb5c54bd91c9714e12c6d742e5a6fd81459b71.zip | |
ls-tree: fix expansion of repeated %(path)
expand_show_tree() borrows the base strbuf given to us by read_tree() to
build the full path of the current entry when handling %(path). Only
its indirect caller, show_tree_fmt(), removes the added entry name.
That works fine as long as %(path) is only included once in the format
string, but accumulates duplicates if it's repeated:
$ git ls-tree --format='%(path) %(path) %(path)' HEAD M*
Makefile MakefileMakefile MakefileMakefileMakefile
Reset the length after each use to get the same expansion every time;
here's the behavior with this patch:
$ ./git ls-tree --format='%(path) %(path) %(path)' HEAD M*
Makefile Makefile Makefile
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
0 files changed, 0 insertions, 0 deletions
