@@ -91,10 +91,11 @@ static int sparse_checkout_list(int argc, const char **argv, const char *prefix,
9191
9292 hashmap_for_each_entry (& pl .recursive_hashmap , & iter , pe , ent ) {
9393 /* pe->pattern starts with "/", skip it */
94- string_list_insert (& sl , pe -> pattern + 1 );
94+ string_list_append (& sl , pe -> pattern + 1 );
9595 }
9696
9797 string_list_sort (& sl );
98+ string_list_remove_duplicates (& sl , 0 );
9899
99100 for (i = 0 ; i < sl .nr ; i ++ ) {
100101 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)
289290 if (!hashmap_contains_parent (& pl -> recursive_hashmap ,
290291 pe -> pattern ,
291292 & parent_pattern ))
292- string_list_insert (& sl , pe -> pattern );
293+ string_list_append (& sl , pe -> pattern );
293294 }
294295
295296 string_list_sort (& sl );
@@ -311,7 +312,7 @@ static void write_cone_to_file(FILE *fp, struct pattern_list *pl)
311312 if (!hashmap_contains_parent (& pl -> recursive_hashmap ,
312313 pe -> pattern ,
313314 & parent_pattern ))
314- string_list_insert (& sl , pe -> pattern );
315+ string_list_append (& sl , pe -> pattern );
315316 }
316317
317318 strbuf_release (& parent_pattern );
0 commit comments