diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-03-28 13:52:19 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-03-28 13:52:19 -0700 |
| commit | cd27bc7a0bdb7e62090c503b9e8ab4b4a6bb3d06 (patch) | |
| tree | d056097ed72d93eedc487640b463bde3650cd9a3 /strbuf.c | |
| parent | c772d1bcdc058d655e6cd3518440a721433cb511 (diff) | |
| parent | 33ad9ddd0b5398063f0aabea639b5fe569f458ea (diff) | |
| download | git-cd27bc7a0bdb7e62090c503b9e8ab4b4a6bb3d06.tar.xz | |
Merge branch 'rs/strbuf-add-real-path' into maint
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; |
