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 <alexandr.miloslavskiy@syntevo.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Alexandr Miloslavskiy
2020-03-10 13:11:24 +00:00
committed by Junio C Hamano
parent 4530a85b4c
commit 49d3c4b481
3 changed files with 14 additions and 14 deletions

View File

@ -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")) {