Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-03-22 00:18:55 +0300
committerJunio C Hamano <gitster@pobox.com>2023-03-22 00:18:55 +0300
commit1071deae006ab5b43ee530ee681eb20a7accc020 (patch)
tree6e837a1951d1566980df2aea734a639e26295aef /builtin
parent15108de2fa0cd8f002a0551d14c84505a853071c (diff)
parentcfb62dd006ae82dd1e06fb177095c8885b40b1c3 (diff)
Merge branch 'aj/ls-files-format-fix'
Fix for a "ls-files --format="%(path)" that produced nonsense output, which was a bug in 2.38. * aj/ls-files-format-fix: ls-files: fix "--format" output of relative paths
Diffstat (limited to 'builtin')
-rw-r--r--builtin/ls-files.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index a03b559eca..26e309f533 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -89,12 +89,15 @@ static void write_name(const char *name)
static void write_name_to_buf(struct strbuf *sb, const char *name)
{
- const char *rel = relative_path(name, prefix_len ? prefix : NULL, sb);
+ struct strbuf buf = STRBUF_INIT;
+ const char *rel = relative_path(name, prefix_len ? prefix : NULL, &buf);
if (line_terminator)
quote_c_style(rel, sb, NULL, 0);
else
strbuf_addstr(sb, rel);
+
+ strbuf_release(&buf);
}
static const char *get_tag(const struct cache_entry *ce, const char *tag)