tar-tree: remove dependency on sq_quote_print()

By rewriting the loop that formats the argv[] in cmd_tar_tree() function using sq_quote_argv() for code simplicity, the last use of sq_quote_print() goes away. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ramkumar Ramachandra committed Jul 30, 2013 at 14:01 UTC 7da2f28c6b6f2370254d285c836c6c43a4b8e559
1 file changed +5 -6
builtin/tar-tree.c
+5 -6
@@ -26,8 +26,8 @@ int cmd_tar_tree(int argc, const char **argv, const char *prefix)
26 * $0 tree-ish basedir ==>
27 * git archive --format-tar --prefix=basedir tree-ish
28 */
29 - int i;
29 const char **nargv = xcalloc(sizeof(*nargv), argc + 3);
30 + struct strbuf sb = STRBUF_INIT;
31 char *basedir_arg;
32 int nargc = 0;
33
@@ -65,11 +65,10 @@ int cmd_tar_tree(int argc, const char **argv, const char *prefix)
65 fprintf(stderr,
66 "*** \"git tar-tree\" is now deprecated.\n"
67 "*** Running \"git archive\" instead.\n***");
68 - for (i = 0; i < nargc; i++) {
69 - fputc(' ', stderr);
70 - sq_quote_print(stderr, nargv[i]);
71 - }
72 - fputc('\n', stderr);
68 + sq_quote_argv(&sb, nargv, 0);
69 + strbuf_addch(&sb, '\n');
70 + fputs(sb.buf, stderr);
71 + strbuf_release(&sb);
72 return cmd_archive(nargc, nargv, prefix);
73 }
74