diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-04-29 17:50:27 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-04-29 17:50:27 -0700 |
commit | 9e234af281107d44116ecf31eef65de145c46d15 (patch) | |
tree | 62c390006f12c74171e5cfcb6c39ff16089570d1 /argv-array.c | |
parent | Merge git://git.bogomips.org/git-svn (diff) | |
parent | gc: use argv-array for sub-commands (diff) | |
download | tgif-9e234af281107d44116ecf31eef65de145c46d15.tar.xz |
Merge branch 'jk/repack-no-explode-objects-from-old-pack'
Avoid writing out unreachable objects as loose objects when repacking,
if such loose objects will immediately pruned due to its age anyway.
By Jeff King
* jk/repack-no-explode-objects-from-old-pack:
gc: use argv-array for sub-commands
argv-array: add a new "pushl" method
argv-array: refactor empty_argv initialization
gc: do not explode objects which will be immediately pruned
Diffstat (limited to 'argv-array.c')
-rw-r--r-- | argv-array.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/argv-array.c b/argv-array.c index a4e04201e6..0b5f8898a1 100644 --- a/argv-array.c +++ b/argv-array.c @@ -2,8 +2,7 @@ #include "argv-array.h" #include "strbuf.h" -static const char *empty_argv_storage = NULL; -const char **empty_argv = &empty_argv_storage; +const char *empty_argv[] = { NULL }; void argv_array_init(struct argv_array *array) { @@ -39,6 +38,17 @@ void argv_array_pushf(struct argv_array *array, const char *fmt, ...) argv_array_push_nodup(array, strbuf_detach(&v, NULL)); } +void argv_array_pushl(struct argv_array *array, ...) +{ + va_list ap; + const char *arg; + + va_start(ap, array); + while((arg = va_arg(ap, const char *))) + argv_array_push(array, arg); + va_end(ap); +} + void argv_array_clear(struct argv_array *array) { if (array->argv != empty_argv) { |