summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Beller <sbeller@google.com>2018-11-28 16:27:50 -0800
committerJunio C Hamano <gitster@pobox.com>2018-12-05 11:42:31 +0900
commit08a297bd4996480f0b03830058f413bb24f0d37c (patch)
tree0c26e4b1901a00dae9a8f5959deff513721a09b4
parent25e3d28efd56124b51e02a3f8496401d4e8fb40b (diff)
downloadgit-08a297bd4996480f0b03830058f413bb24f0d37c.tar.gz
git-08a297bd4996480f0b03830058f413bb24f0d37c.tar.xz
submodule.c: sort changed_submodule_names before searching it
We can string_list_insert() to maintain sorted-ness of the list as we find new items, or we can string_list_append() to build an unsorted list and sort it at the end just once. As we do not rely on the sortedness while building the list, we pick the "append and sort at the end" as it has better worst case execution times. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--submodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/submodule.c b/submodule.c
index bc48ea3b6..3c388f85c 100644
--- a/submodule.c
+++ b/submodule.c
@@ -1283,7 +1283,7 @@ static int get_next_submodule(struct child_process *cp,
case RECURSE_SUBMODULES_DEFAULT:
case RECURSE_SUBMODULES_ON_DEMAND:
if (!submodule ||
- !unsorted_string_list_lookup(
+ !string_list_lookup(
&changed_submodule_names,
submodule->name))
continue;
@@ -1377,6 +1377,7 @@ int fetch_populated_submodules(struct repository *r,
/* default value, "--submodule-prefix" and its value are added later */
calculate_changed_submodule_paths(r);
+ string_list_sort(&changed_submodule_names);
run_processes_parallel(max_parallel_jobs,
get_next_submodule,
fetch_start_failure,