aboutsummaryrefslogtreecommitdiffstats
path: root/submodule.c
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>2020-03-10 13:11:23 +0000
committerJunio C Hamano <gitster@pobox.com>2020-03-10 11:41:40 -0700
commit4530a85b4c34f009b5f190eb2dc8367801de5028 (patch)
tree8e6a4c01147521978d89637b87d50ab75546d647 /submodule.c
parent3d7747e318532a36a263c61cdf92f2decb6424ff (diff)
downloadgit-4530a85b4c34f009b5f190eb2dc8367801de5028.tar.gz
real_path_if_valid(): remove unsafe API
This commit continues the work started with previous commit. Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/submodule.c b/submodule.c
index bad7a788c0..215c62580f 100644
--- a/submodule.c
+++ b/submodule.c
@@ -2173,7 +2173,7 @@ const char *get_superproject_working_tree(void)
static struct strbuf realpath = STRBUF_INIT;
struct child_process cp = CHILD_PROCESS_INIT;
struct strbuf sb = STRBUF_INIT;
- const char *one_up = real_path_if_valid("../");
+ struct strbuf one_up = STRBUF_INIT;
const char *cwd = xgetcwd();
const char *ret = NULL;
const char *subpath;
@@ -2188,10 +2188,11 @@ const char *get_superproject_working_tree(void)
*/
return NULL;
- if (!one_up)
+ if (!strbuf_realpath(&one_up, "../", 0))
return NULL;
- subpath = relative_path(cwd, one_up, &sb);
+ subpath = relative_path(cwd, one_up.buf, &sb);
+ strbuf_release(&one_up);
prepare_submodule_repo_env(&cp.env_array);
argv_array_pop(&cp.env_array);