Re: [RFC PATCH 1/7] Makefile: alphabetically sort += lists
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 22, 2019, 11:34 UTC
- Message-ID
- <xmqq7e4xko8v.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20191021195413.GB3959@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
>> ... >> I agree with you that it did correctly sort them in ASCII order. > > What's the purpose of sorting them, though? I thought it was less for > aesthetics and more to to keep lines deterministic (to avoid two > branches adding the same line in different places, thus causing > weirdness when the two are merged). In that case, I think we care less > about the exact order and more that anybody can easily reproduce the > same sort (by running "10:!sort" or whatever you weird emacs-types would > type).
In the ideal world, "sort" would have a handy option we can tell it to reshuffle the ASCII table in such a way that all punctuations come before alphanumeric, making sure "/" and "." are the first two letters in the alphabet, and everybody can use it to sort the lines reproducibly and also readably. But I do not know of such a widely used implementation of "sort", so...
If we had known better, we would have used such a custom sort order to sort the index entries, making sure that slash sorts before any other byte ;-)