]> git.ipfire.org Git - thirdparty/git.git/commit
string-list: add string_list_sort_u() that mimics "sort -u"
authorAmisha Chhajed <amishhhaaaa@gmail.com>
Thu, 29 Jan 2026 12:12:20 +0000 (17:42 +0530)
committerJunio C Hamano <gitster@pobox.com>
Thu, 29 Jan 2026 17:32:50 +0000 (09:32 -0800)
commit2e711acfbdfc0fedf631688d78cde153ba835c93
treeb8725125128340b97c086e32e78117284cbbe75d
parent208642cfbb53781602af1fa77c67322c0aab0ad9
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>
builtin/clone.c
builtin/fast-export.c
builtin/pack-objects.c
builtin/sparse-checkout.c
help.c
notes.c
string-list.c
string-list.h
t/unit-tests/u-string-list.c