summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>2020-03-10 13:11:24 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-03-10 18:41:40 (GMT)
commit49d3c4b481f12c2ec655a71d5a5b9259a398d059 (patch)
treea678f157d48912fff898af8044b98b9a3f004714 /builtin
parent4530a85b4c34f009b5f190eb2dc8367801de5028 (diff)
downloadgit-49d3c4b481f12c2ec655a71d5a5b9259a398d059.zip
git-49d3c4b481f12c2ec655a71d5a5b9259a398d059.tar.gz
git-49d3c4b481f12c2ec655a71d5a5b9259a398d059.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/rev-parse.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 06ca717..0605643 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")) {