summaryrefslogtreecommitdiff
path: root/strbuf.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-10 21:24:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-03-10 21:24:23 (GMT)
commitfc32293502e86be2cabbe5e8e5863a2b657207b8 (patch)
tree87798ac7776dc9473d09f94ec45b96398cbc16b9 /strbuf.h
parent82682e218a4ebe980345908c31ac9976f7ef4283 (diff)
parent33ad9ddd0b5398063f0aabea639b5fe569f458ea (diff)
downloadgit-fc32293502e86be2cabbe5e8e5863a2b657207b8.zip
git-fc32293502e86be2cabbe5e8e5863a2b657207b8.tar.gz
git-fc32293502e86be2cabbe5e8e5863a2b657207b8.tar.bz2
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 cf1b540..cf8e4bf 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