summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Ramkumar Ramachandra <artagnon@gmail.com>2013-07-30 14:01:26 +0530
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-07-30 08:10:35 -0700
commit7da2f28c6b6f2370254d285c836c6c43a4b8e559 (patch)
tree863a0e77ee75199e593c6a0ce4ff8d057c54eb95
parentfor-each-ref, quote: convert *_quote_print -> *_quote_buf (diff)
downloadtgif-7da2f28c6b6f2370254d285c836c6c43a4b8e559.tar.xz
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>
-rw-r--r--builtin/tar-tree.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/builtin/tar-tree.c b/builtin/tar-tree.c
index 3f1e7012db..ba3ffe69a9 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);
}