Merge branch 'ah/log-decorate-default-to-auto' into maint
[gitweb.git] / strbuf.c
index 01d25942014f277122dfe826f47a6be4d8d35474..00457940cfc163fed58b0206f5167c25c2c71b8a 100644 (file)
--- a/strbuf.c
+++ b/strbuf.c
@@ -718,6 +718,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;