Merge branch 'ls/p4-test-updates'
[gitweb.git] / dir.c
diff --git a/dir.c b/dir.c
index fba938b70166a9397d072bf1e05a393375a0dbc5..109ceeaed3fb899c0e98a7abfc2f38a6cfa7fe0e 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1596,8 +1596,7 @@ static enum path_treatment treat_path_fast(struct dir_struct *dir,
        }
        strbuf_addstr(path, cdir->ucd->name);
        /* treat_one_path() does this before it calls treat_directory() */
-       if (path->buf[path->len - 1] != '/')
-               strbuf_addch(path, '/');
+       strbuf_complete(path, '/');
        if (cdir->ucd->check_only)
                /*
                 * check_only is set as a result of treat_directory() getting
@@ -2212,8 +2211,7 @@ static int remove_dir_recurse(struct strbuf *path, int flag, int *kept_up)
                else
                        return -1;
        }
-       if (path->buf[original_len - 1] != '/')
-               strbuf_addch(path, '/');
+       strbuf_complete(path, '/');
 
        len = path->len;
        while ((e = readdir(dir)) != NULL) {