abspath: add absolute_pathdup()
[gitweb.git] / abspath.c
index 2825de85912fc730d9a40fa66f4f83b6250a4171..af82abd033ae8361adf825a01567ab5c1d472468 100644 (file)
--- a/abspath.c
+++ b/abspath.c
@@ -152,6 +152,13 @@ const char *absolute_path(const char *path)
        return sb.buf;
 }
 
+char *absolute_pathdup(const char *path)
+{
+       struct strbuf sb = STRBUF_INIT;
+       strbuf_add_absolute_path(&sb, path);
+       return strbuf_detach(&sb, NULL);
+}
+
 /*
  * Unlike prefix_path, this should be used if the named file does
  * not have to interact with index entry; i.e. name of a random file