Re: [RFC PATCH 1/2] Adding string_list_sort_u which sorts a list then deduplicates it.
On Fri, 23 Jan 2026 at 03:37, Junio C Hamano <gitster@pobox.com> wrote:
Show 52 quoted lines
>
> Amisha Chhajed <amishhhaaaa@gmail.com> writes:
>
> > string_list_remove_duplicates is almost always preceeded by
> > string_list_sort, hence adding string_list_sort_u which dedupliactes
> > post sorting.
>
> The usual way to compose a log message of this project is to
>
> - Give an observation on how the current system works in the
> present tense (so no need to say "Currently X is Y", or
> "Previously X was Y" to describe the state before your change;
> just "X is Y" is enough), and discuss what you perceive as a
> problem in it.
>
> - Propose a solution (optional---often, problem description
> trivially leads to an obvious solution in reader's minds).
>
> - Give commands to somebody editing the codebase to "make it so",
> instead of saying "This commit does X".
>
> in this order.
>
> To those who have been intimately following the discussion, it often
> is understandable without some of the above, but we are not writing
> for those who review the patches. We are primarily writing for future
> readers of "git log" who are not aware of the review discussion we
> have on list, so we should give something to prepare them by setting
> the stage and stating the objective first, before going into how the
> patch solved it.
>
> With that in mind, perhaps something along this line ...
>
>
> Subject: string-list: add string_list_sort_u() that mimics "sort -u"
>
> Many callsites of string_list_remove_duplicates() call it
> immediately after calling string_list_sort(). It is
> understandable because the former requires the string-list to be
> sorted, but at the same time, 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 help simplify
> these callsites.
>
> ... probably?
>
> The same comment applies to the way the other patch is explained.
>
> Thanks.
>
Very helpful, thank you so much, i will keep in mind.