Skip to content

Commit 08a297b

Browse files
stefanbellergitster
authored andcommitted
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>
1 parent 25e3d28 commit 08a297b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

submodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ static int get_next_submodule(struct child_process *cp,
12831283
case RECURSE_SUBMODULES_DEFAULT:
12841284
case RECURSE_SUBMODULES_ON_DEMAND:
12851285
if (!submodule ||
1286-
!unsorted_string_list_lookup(
1286+
!string_list_lookup(
12871287
&changed_submodule_names,
12881288
submodule->name))
12891289
continue;
@@ -1377,6 +1377,7 @@ int fetch_populated_submodules(struct repository *r,
13771377
/* default value, "--submodule-prefix" and its value are added later */
13781378

13791379
calculate_changed_submodule_paths(r);
1380+
string_list_sort(&changed_submodule_names);
13801381
run_processes_parallel(max_parallel_jobs,
13811382
get_next_submodule,
13821383
fetch_start_failure,

0 commit comments

Comments
 (0)