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:
authorBrandon Williams <bmwill@google.com>2016-12-12 21:16:54 +0300
committerJunio C Hamano <gitster@pobox.com>2016-12-13 02:22:32 +0300
commit72417640769c91408d15cdbab3160bc494f49c7f (patch)
tree0fb36a529a18a71a5690fcb01887c7c7d2067039 /abspath.c
parenta1ae48410dce23c1e81e76aabaeb4eb01b065763 (diff)
real_path: create real_pathdup
Create real_pathdup which returns a caller owned string of the resolved realpath based on the provide path. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'abspath.c')
-rw-r--r--abspath.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/abspath.c b/abspath.c
index 8c6c76b05e..79ee310867 100644
--- a/abspath.c
+++ b/abspath.c
@@ -205,6 +205,19 @@ const char *real_path_if_valid(const char *path)
return strbuf_realpath(&realpath, path, 0);
}
+char *real_pathdup(const char *path)
+{
+ struct strbuf realpath = STRBUF_INIT;
+ char *retval = NULL;
+
+ if (strbuf_realpath(&realpath, path, 0))
+ retval = strbuf_detach(&realpath, NULL);
+
+ strbuf_release(&realpath);
+
+ return retval;
+}
+
/*
* Use this to get an absolute path from a relative one. If you want
* to resolve links, you should use real_path.