summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-03-10 13:24:23 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-03-10 13:24:23 -0800
commitfc32293502e86be2cabbe5e8e5863a2b657207b8 (patch)
tree87798ac7776dc9473d09f94ec45b96398cbc16b9 /strbuf.h
parentMerge branch 'rs/sha1-file-plug-fallback-base-leak' (diff)
parentstrbuf: add strbuf_add_real_path() (diff)
downloadtgif-fc32293502e86be2cabbe5e8e5863a2b657207b8.tar.xz
Merge branch 'rs/strbuf-add-real-path'
An helper function to make it easier to append the result from real_path() to a strbuf has been added. * rs/strbuf-add-real-path: strbuf: add strbuf_add_real_path() cocci: use ALLOC_ARRAY
Diffstat (limited to 'strbuf.h')
-rw-r--r--strbuf.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/strbuf.h b/strbuf.h
index cf1b5409e7..cf8e4bf532 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -441,6 +441,20 @@ extern int strbuf_getcwd(struct strbuf *sb);
*/
extern void strbuf_add_absolute_path(struct strbuf *sb, const char *path);
+/**
+ * Canonize `path` (make it absolute, resolve symlinks, remove extra
+ * slashes) and append it to `sb`. Die with an informative error
+ * message if there is a problem.
+ *
+ * The directory part of `path` (i.e., everything up to the last
+ * dir_sep) must denote a valid, existing directory, but the last
+ * component need not exist.
+ *
+ * Callers that don't mind links should use the more lightweight
+ * strbuf_add_absolute_path() instead.
+ */
+extern void strbuf_add_real_path(struct strbuf *sb, const char *path);
+
/**
* Normalize in-place the path contained in the strbuf. See