mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
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>
This commit is contained in:
parent
10d0167fef
commit
7da2f28c6b
|
@ -26,8 +26,8 @@ int cmd_tar_tree(int argc, const char **argv, const char *prefix)
|
||||||
* $0 tree-ish basedir ==>
|
* $0 tree-ish basedir ==>
|
||||||
* git archive --format-tar --prefix=basedir tree-ish
|
* git archive --format-tar --prefix=basedir tree-ish
|
||||||
*/
|
*/
|
||||||
int i;
|
|
||||||
const char **nargv = xcalloc(sizeof(*nargv), argc + 3);
|
const char **nargv = xcalloc(sizeof(*nargv), argc + 3);
|
||||||
|
struct strbuf sb = STRBUF_INIT;
|
||||||
char *basedir_arg;
|
char *basedir_arg;
|
||||||
int nargc = 0;
|
int nargc = 0;
|
||||||
|
|
||||||
|
@ -65,11 +65,10 @@ int cmd_tar_tree(int argc, const char **argv, const char *prefix)
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"*** \"git tar-tree\" is now deprecated.\n"
|
"*** \"git tar-tree\" is now deprecated.\n"
|
||||||
"*** Running \"git archive\" instead.\n***");
|
"*** Running \"git archive\" instead.\n***");
|
||||||
for (i = 0; i < nargc; i++) {
|
sq_quote_argv(&sb, nargv, 0);
|
||||||
fputc(' ', stderr);
|
strbuf_addch(&sb, '\n');
|
||||||
sq_quote_print(stderr, nargv[i]);
|
fputs(sb.buf, stderr);
|
||||||
}
|
strbuf_release(&sb);
|
||||||
fputc('\n', stderr);
|
|
||||||
return cmd_archive(nargc, nargv, prefix);
|
return cmd_archive(nargc, nargv, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue