From 18322badc2b3b7f49f79da5273e003e9c0c4f549 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Fri, 9 Sep 2011 20:22:03 +0200 Subject: fetch: skip on-demand checking when no submodules are configured It makes no sense to do the - possibly very expensive - call to "rev-list --not --all" in check_for_new_submodule_commits() when there aren't any submodules configured. Leave check_for_new_submodule_commits() early when no name <-> path mappings for submodules are found in the configuration. To make that work reading the configuration had to be moved further up in cmd_fetch(), as doing that after the actual fetch of the superproject was too late. Reported-by: Martin Fick Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- submodule.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'submodule.c') diff --git a/submodule.c b/submodule.c index b6dec70bd1..e0d5dcfedd 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); -- cgit v1.2.1