Re: [bug report] git-am applying maildir patches in reverse
- From
Jeff King <peff@peff.net>
- Date
- Mar 3, 2013, 06:32 UTC
- Message-ID
- <20130303063244.GB23221@sigill.intra.peff.net>
- In-Reply-To
- <7vtxotc895.fsf@alter.siamese.dyndns.org>
On Sat, Mar 02, 2013 at 10:22:46PM -0800, Junio C Hamano wrote:
Show 9 quoted lines
> Andreas Schwab <schwab@linux-m68k.org> writes: > > > You should always cast to unsigned char when determining the order of > > characters, to be consistent with strcmp/memcmp. > > We treat runs of digits as numbers, so it is not even similar to > strcmp. As long as it is internally consistent (i.e. the return > value inside the loop (*a - *b) must match the last return), it > should be OK, no?
I almost responded and said something similar, but we also do byte-wise comparisons for non-numeric elements, and we would want those to match what other programs may do (and what git used to do).
I highly doubt that it matters in practice, as it would mean:
1. The sorting of a maildir's filenames are dependent on the sorting
of non-numeric bits. We can't rule out such a scheme, but I'd guess
implementations either use numbers, or their sort order is
meaningless (and that is what I found in the ones I looked at). 2. The importantly-sorted bits contain non-ascii characters (the
difference is only seen when we go outside the signed range).but it doesn't hurt to be thorough (and to set a good example).
-Peff