From 2e711acfbdfc0fedf631688d78cde153ba835c93 Mon Sep 17 00:00:00 2001 From: Amisha Chhajed Date: Thu, 29 Jan 2026 17:42:20 +0530 Subject: string-list: add string_list_sort_u() that mimics "sort -u" Many callsites of string_list_remove_duplicates() call it immdediately after calling string_list_sort(), understandably as the former requires string-list to be sorted, it is clear that these places are sorting only to remove duplicates and for no other reason. Introduce a helper function string_list_sort_u that combines these two calls that often appear together, to simplify these callsites. Replace the current calls of those methods with string_list_sort_u(). Signed-off-by: Amisha Chhajed Signed-off-by: Junio C Hamano --- notes.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'notes.c') diff --git a/notes.c b/notes.c index 8e00fd8c47..090c48bbd5 100644 --- a/notes.c +++ b/notes.c @@ -921,8 +921,7 @@ int combine_notes_cat_sort_uniq(struct object_id *cur_oid, if (string_list_add_note_lines(&sort_uniq_list, new_oid)) goto out; string_list_remove_empty_items(&sort_uniq_list, 0); - string_list_sort(&sort_uniq_list); - string_list_remove_duplicates(&sort_uniq_list, 0); + string_list_sort_u(&sort_uniq_list, 0); /* create a new blob object from sort_uniq_list */ if (for_each_string_list(&sort_uniq_list, -- cgit v1.3