From: Junio C Hamano Date: Wed, 5 Oct 2011 19:35:54 +0000 (-0700) Subject: Merge branch 'jk/maint-fetch-submodule-check-fix' X-Git-Tag: v1.7.8-rc0~152 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6be70d6bb94c625d912ebaef312c5dc5a397ec24;p=git.git Merge branch 'jk/maint-fetch-submodule-check-fix' * jk/maint-fetch-submodule-check-fix: fetch: avoid quadratic loop checking for updated submodules --- 6be70d6bb94c625d912ebaef312c5dc5a397ec24 diff --cc submodule.c index ad86534ba,9431c42df..08756387e --- a/submodule.c +++ b/submodule.c @@@ -478,16 -426,17 +534,21 @@@ static void calculate_changed_submodule { struct rev_info rev; struct commit *commit; - const char *argv[] = {NULL, NULL, "--not", "--all", NULL}; - int argc = ARRAY_SIZE(argv) - 1; + struct argv_array argv; + /* No need to check if there are no submodules configured */ + if (!config_name_for_path.nr) + return; + init_revisions(&rev, NULL); - argv[1] = xstrdup(sha1_to_hex(new_sha1)); - setup_revisions(argc, argv, &rev, NULL); + init_argv(&argv); + push_argv(&argv, "--"); /* argv[0] program name */ + sha1_array_for_each_unique(&ref_tips_after_fetch, + add_sha1_to_argv, &argv); + push_argv(&argv, "--not"); + sha1_array_for_each_unique(&ref_tips_before_fetch, + add_sha1_to_argv, &argv); + setup_revisions(argv.argc, argv.argv, &rev, NULL); if (prepare_revision_walk(&rev)) die("revision walk setup failed");