diff options
| author | Amisha Chhajed <amishhhaaaa@gmail.com> | 2026-01-29 17:42:20 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-01-29 09:32:50 -0800 |
| commit | 2e711acfbdfc0fedf631688d78cde153ba835c93 (patch) | |
| tree | b8725125128340b97c086e32e78117284cbbe75d /help.c | |
| parent | 208642cfbb53781602af1fa77c67322c0aab0ad9 (diff) | |
| download | git-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 'help.c')
| -rw-r--r-- | help.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -420,8 +420,7 @@ void list_cmds_by_config(struct string_list *list) if (repo_config_get_string_tmp(the_repository, "completion.commands", &cmd_list)) return; - string_list_sort(list); - string_list_remove_duplicates(list, 0); + string_list_sort_u(list, 0); while (*cmd_list) { struct strbuf sb = STRBUF_INIT; |
