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.c | |
| parent | 82682e218a4ebe980345908c31ac9976f7ef4283 (diff) | |
| parent | 33ad9ddd0b5398063f0aabea639b5fe569f458ea (diff) | |
| download | git-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.c')
| -rw-r--r-- | strbuf.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -707,6 +707,17 @@ void strbuf_add_absolute_path(struct strbuf *sb, const char *path) strbuf_addstr(sb, path); } +void strbuf_add_real_path(struct strbuf *sb, const char *path) +{ + if (sb->len) { + struct strbuf resolved = STRBUF_INIT; + strbuf_realpath(&resolved, path, 1); + strbuf_addbuf(sb, &resolved); + strbuf_release(&resolved); + } else + strbuf_realpath(sb, path, 1); +} + int printf_ln(const char *fmt, ...) { int ret; |
