mirror of
https://github.com/git/git.git
synced 2026-01-23 15:27:19 +09:00
Merge branch 'ac/sparse-checkout-string-list-cleanup' into jch
Code clean-up. * ac/sparse-checkout-string-list-cleanup: sparse-checkout: optimize string_list construction
This commit is contained in:
commit
0e24962616
@ -91,10 +91,11 @@ static int sparse_checkout_list(int argc, const char **argv, const char *prefix,
|
||||
|
||||
hashmap_for_each_entry(&pl.recursive_hashmap, &iter, pe, ent) {
|
||||
/* pe->pattern starts with "/", skip it */
|
||||
string_list_insert(&sl, pe->pattern + 1);
|
||||
string_list_append(&sl, pe->pattern + 1);
|
||||
}
|
||||
|
||||
string_list_sort(&sl);
|
||||
string_list_remove_duplicates(&sl, 0);
|
||||
|
||||
for (i = 0; i < sl.nr; i++) {
|
||||
quote_c_style(sl.items[i].string, NULL, stdout, 0);
|
||||
@ -289,7 +290,7 @@ static void write_cone_to_file(FILE *fp, struct pattern_list *pl)
|
||||
if (!hashmap_contains_parent(&pl->recursive_hashmap,
|
||||
pe->pattern,
|
||||
&parent_pattern))
|
||||
string_list_insert(&sl, pe->pattern);
|
||||
string_list_append(&sl, pe->pattern);
|
||||
}
|
||||
|
||||
string_list_sort(&sl);
|
||||
@ -311,7 +312,7 @@ static void write_cone_to_file(FILE *fp, struct pattern_list *pl)
|
||||
if (!hashmap_contains_parent(&pl->recursive_hashmap,
|
||||
pe->pattern,
|
||||
&parent_pattern))
|
||||
string_list_insert(&sl, pe->pattern);
|
||||
string_list_append(&sl, pe->pattern);
|
||||
}
|
||||
|
||||
strbuf_release(&parent_pattern);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user