From 49d3c4b481f12c2ec655a71d5a5b9259a398d059 Mon Sep 17 00:00:00 2001 From: Alexandr Miloslavskiy Date: Tue, 10 Mar 2020 13:11:24 +0000 Subject: get_superproject_working_tree(): return strbuf Together with the previous commits, this commit fully fixes the problem of using shared buffer for `real_path()` in `get_superproject_working_tree()`. Signed-off-by: Alexandr Miloslavskiy Signed-off-by: Junio C Hamano --- builtin/rev-parse.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'builtin/rev-parse.c') diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 06ca7175ac..06056434ed 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -808,9 +808,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) continue; } if (!strcmp(arg, "--show-superproject-working-tree")) { - const char *superproject = get_superproject_working_tree(); - if (superproject) - puts(superproject); + struct strbuf superproject = STRBUF_INIT; + if (get_superproject_working_tree(&superproject)) + puts(superproject.buf); + strbuf_release(&superproject); continue; } if (!strcmp(arg, "--show-prefix")) { -- cgit v1.3