diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-10 13:24:23 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-10 13:24:23 -0800 |
commit | fc32293502e86be2cabbe5e8e5863a2b657207b8 (patch) | |
tree | 87798ac7776dc9473d09f94ec45b96398cbc16b9 /strbuf.h | |
parent | Merge branch 'rs/sha1-file-plug-fallback-base-leak' (diff) | |
parent | strbuf: add strbuf_add_real_path() (diff) | |
download | tgif-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.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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 |