]> git.ipfire.org Git - thirdparty/git.git/blobdiff - url.c
use strbuf_complete to conditionally append slash
[thirdparty/git.git] / url.c
diff --git a/url.c b/url.c
index 7ca2a69e1091fc57cb292052015c920499fe3379..2d89ad190cfe1c57cd20194661329551ff229993 100644 (file)
--- a/url.c
+++ b/url.c
@@ -120,8 +120,7 @@ char *url_decode_parameter_value(const char **query)
 void end_url_with_slash(struct strbuf *buf, const char *url)
 {
        strbuf_addstr(buf, url);
-       if (buf->len && buf->buf[buf->len - 1] != '/')
-               strbuf_addch(buf, '/');
+       strbuf_complete(buf, '/');
 }
 
 void str_end_url_with_slash(const char *url, char **dest) {