From: Junio C Hamano Date: Wed, 26 Oct 2011 23:13:31 +0000 (-0700) Subject: Merge branch 'jk/argv-array' into maint X-Git-Tag: v1.7.8-rc0~7^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=60f60b49629b6693ce5b8ce9201b2f6dd3989354;p=git.git Merge branch 'jk/argv-array' into maint * jk/argv-array: run_hook: use argv_array API checkout: use argv_array API bisect: use argv_array API quote: provide sq_dequote_to_argv_array refactor argv_array into generic code quote.h: fix bogus comment add sha1_array API docs --- 60f60b49629b6693ce5b8ce9201b2f6dd3989354 diff --cc bisect.c index c7b7d7913,ef92871e3..de05bf824 --- a/bisect.c +++ b/bisect.c @@@ -16,15 -17,8 +17,9 @@@ static struct sha1_array skipped_revs static const unsigned char *current_bad_sha1; - struct argv_array { - const char **argv; - int argv_nr; - int argv_alloc; - }; - static const char *argv_checkout[] = {"checkout", "-q", NULL, "--", NULL}; static const char *argv_show_branch[] = {"show-branch", NULL, NULL}; +static const char *argv_update_ref[] = {"update-ref", "--no-deref", "BISECT_HEAD", NULL, NULL}; /* bits #0-15 in revision.h */ diff --cc submodule.c index 08756387e,6306737ed..0b709bc29 --- a/submodule.c +++ b/submodule.c @@@ -534,18 -398,13 +506,17 @@@ static void calculate_changed_submodule { struct rev_info rev; struct commit *commit; - struct argv_array argv; + struct argv_array argv = ARGV_ARRAY_INIT; + /* No need to check if there are no submodules configured */ + if (!config_name_for_path.nr) + return; + init_revisions(&rev, NULL); - init_argv(&argv); - push_argv(&argv, "--"); /* argv[0] program name */ + argv_array_push(&argv, "--"); /* argv[0] program name */ sha1_array_for_each_unique(&ref_tips_after_fetch, add_sha1_to_argv, &argv); - push_argv(&argv, "--not"); + argv_array_push(&argv, "--not"); sha1_array_for_each_unique(&ref_tips_before_fetch, add_sha1_to_argv, &argv); setup_revisions(argv.argc, argv.argv, &rev, NULL);