diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-09-12 10:19:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-09-12 10:19:57 -0700 |
commit | 8702fee6171abb2e353499fa0cecba90ad5f277f (patch) | |
tree | 64366b7892e0fa5aac9c9526f77f532535c7f548 | |
parent | c2d53586ddfdde1ff625fe58299dc81db5e6f408 (diff) | |
parent | 18322badc2b3b7f49f79da5273e003e9c0c4f549 (diff) | |
download | git-8702fee6171abb2e353499fa0cecba90ad5f277f.tar.gz |
Merge branch 'jl/maint-fetch-submodule-check-fix' into maint
* jl/maint-fetch-submodule-check-fix:
fetch: skip on-demand checking when no submodules are configured
-rw-r--r-- | builtin/fetch.c | 15 | ||||
-rw-r--r-- | submodule.c | 4 |
2 files changed, 13 insertions, 6 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c index 93c99385a9..e422ced929 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -941,6 +941,15 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) argc = parse_options(argc, argv, prefix, builtin_fetch_options, builtin_fetch_usage, 0); + if (recurse_submodules != RECURSE_SUBMODULES_OFF) { + if (recurse_submodules_default) { + int arg = parse_fetch_recurse_submodules_arg("--recurse-submodules-default", recurse_submodules_default); + set_config_fetch_recurse_submodules(arg); + } + gitmodules_config(); + git_config(submodule_config, NULL); + } + if (all) { if (argc == 1) die(_("fetch --all does not take a repository argument")); @@ -976,12 +985,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) if (!result && (recurse_submodules != RECURSE_SUBMODULES_OFF)) { const char *options[10]; int num_options = 0; - if (recurse_submodules_default) { - int arg = parse_fetch_recurse_submodules_arg("--recurse-submodules-default", recurse_submodules_default); - set_config_fetch_recurse_submodules(arg); - } - gitmodules_config(); - git_config(submodule_config, NULL); add_options_to_argv(&num_options, options); result = fetch_populated_submodules(num_options, options, submodule_prefix, diff --git a/submodule.c b/submodule.c index 1ba9646d34..b648927509 100644 --- a/submodule.c +++ b/submodule.c @@ -373,6 +373,10 @@ void check_for_new_submodule_commits(unsigned char new_sha1[20]) const char *argv[] = {NULL, NULL, "--not", "--all", NULL}; int argc = ARRAY_SIZE(argv) - 1; + /* 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); |