Currently, there is exactly one caller of sq_quote_print(), namely
cmd_tar_tree().  In the interest of removing sq_quote_print() and
simplification, replace it with an equivalent call to sq_quote_argv().
No functional changes intended.

Signed-off-by: Ramkumar Ramachandra <artag...@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 builtin/tar-tree.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/builtin/tar-tree.c b/builtin/tar-tree.c
index 3f1e701..ba3ffe6 100644
--- a/builtin/tar-tree.c
+++ b/builtin/tar-tree.c
@@ -26,8 +26,8 @@ int cmd_tar_tree(int argc, const char **argv, const char 
*prefix)
         * $0 tree-ish basedir ==>
         *      git archive --format-tar --prefix=basedir tree-ish
         */
-       int i;
        const char **nargv = xcalloc(sizeof(*nargv), argc + 3);
+       struct strbuf sb = STRBUF_INIT;
        char *basedir_arg;
        int nargc = 0;
 
@@ -65,11 +65,10 @@ int cmd_tar_tree(int argc, const char **argv, const char 
*prefix)
        fprintf(stderr,
                "*** \"git tar-tree\" is now deprecated.\n"
                "*** Running \"git archive\" instead.\n***");
-       for (i = 0; i < nargc; i++) {
-               fputc(' ', stderr);
-               sq_quote_print(stderr, nargv[i]);
-       }
-       fputc('\n', stderr);
+       sq_quote_argv(&sb, nargv, 0);
+       strbuf_addch(&sb, '\n');
+       fputs(sb.buf, stderr);
+       strbuf_release(&sb);
        return cmd_archive(nargc, nargv, prefix);
 }
 
-- 
1.8.4.rc0.4.g4634265

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to