git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 0/2] Adding string_list_sort_u to replace combined calls of string_list_sort and string_list_remove_duplicates calls.

From
Amisha Chhajed <amishhhaaaa@gmail.com>
Date
Jan 22, 2026, 17:15 UTC
Message-ID
<20260122171523.94234-1-amishhhaaaa@gmail.com>

Following up with Junio's suggestion in https://lore.kernel.org/git/xmqqqzrp74q3.fsf@gitster.g/, calls to string_list_remove_duplicates are almost always preceeded by string_list_sort which can be coupled into a single method.

There are places, for example the call of string_list_remove_duplicates in pack-objects.c where removal of that line causes no test failures, however removal of string_list_sort_u version did because removing sort is a more catchable behaviour by the current tests, this might improve the case where we were unsure why removing string_list_remove_duplicates caused no test failures.

I was unable to write unit tests for this new method in this RFC PATCH since I was quite unsure why no unit tests were present for string_list_sort and string_list_insert.

Amisha Chhajed (2):
  Adding string_list_sort_u which sorts a list then deduplicates it.
  Replacing calls of string_list_sort and string_list_remove_duplicates
    with the combined variant string_list_u.
 builtin/clone.c           | 3 +--
 builtin/fast-export.c     | 3 +--
 builtin/pack-objects.c    | 6 ++----
 builtin/sparse-checkout.c | 6 ++----
 help.c                    | 3 +--
 notes.c                   | 3 +--
 string-list.c             | 6 ++++++
 string-list.h             | 6 ++++++
 8 files changed, 20 insertions(+), 16 deletions(-)
-- 
2.51.0
Next: Amisha Chhajed
Message 1 of 24 in “Adding string_list_sort_u to replace combined calls of string_list_sort and string_list_remove_duplicates calls.”
  1. 0/2 Adding string_list_sort_u to replace combined calls of string_list_sort and string_list_remove_duplicates calls.Amisha Chhajed, Jan 22, 2026
  2. 1/2 Adding string_list_sort_u which sorts a list then deduplicates it.Amisha Chhajed, Jan 22, 2026
  3. Junio C HamanoJan 22, 2026
  4. Amisha ChhajedJan 25, 2026
  5. 2/2 Replacing calls of string_list_sort and string_list_remove_duplicates with the combined variant string_list_u.Amisha Chhajed, Jan 22, 2026
  6. Junio C HamanoJan 22, 2026
  7. Junio C HamanoJan 22, 2026
  8. 1/2 u-string-list: add unit tests for string-list methodsAmisha Chhajed, Jan 25, 2026
  9. 2/2 string-list: add string_list_sort_u() that mimics "sort -u"Amisha Chhajed, Jan 25, 2026
  10. 1/2 u-string-list: add unit tests for string-list methodsAmisha Chhajed, Jan 29, 2026
  11. 2/2 string-list: add string_list_sort_u() that mimics "sort -u"Amisha Chhajed, Jan 29, 2026
  12. Amisha ChhajedJan 29, 2026
  13. Kristoffer HaugsbakkJan 30, 2026
  14. Junio C HamanoJan 30, 2026
  15. Junio C HamanoJan 26, 2026
  16. Amisha ChhajedJan 26, 2026
  17. Junio C HamanoJan 26, 2026
  18. 1/2 u-string-list: add unit tests for string-list methodsAmisha Chhajed, Jan 25, 2026
  19. 2/2 string-list: add string_list_sort_u() that mimics "sort -u"Amisha Chhajed, Jan 25, 2026
  20. 1/2 u-string-list: add unit tests for string-list methodsAmisha Chhajed, Jan 26, 2026
  21. 2/2 string-list: add string_list_sort_u() that mimics "sort -u"Amisha Chhajed, Jan 26, 2026
  22. Junio C HamanoJan 26, 2026
  23. Amisha ChhajedJan 27, 2026
  24. Junio C HamanoJan 26, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.