aboutsummaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorAmisha Chhajed <amishhhaaaa@gmail.com>2026-01-29 17:42:20 +0530
committerJunio C Hamano <gitster@pobox.com>2026-01-29 09:32:50 -0800
commit2e711acfbdfc0fedf631688d78cde153ba835c93 (patch)
treeb8725125128340b97c086e32e78117284cbbe75d /notes.c
parent208642cfbb53781602af1fa77c67322c0aab0ad9 (diff)
downloadgit-2e711acfbdfc0fedf631688d78cde153ba835c93.tar.xz
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 <amishhhaaaa@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c3
1 files changed, 1 insertions, 2 deletions
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,