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

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
Previous: Junio C HamanoNext: Jeff King
Message 13 of 14 in “[bug report] git-am applying maildir patches in reverse”
  1. William GiokasMar 1, 2013
  2. Junio C HamanoMar 1, 2013
  3. Jeff KingMar 1, 2013
  4. Jeff KingMar 1, 2013
  5. Junio C HamanoMar 1, 2013
  6. Jeff KingMar 1, 2013
  7. Junio C HamanoMar 1, 2013
  8. Jeff KingMar 2, 2013
  9. Junio C HamanoMar 2, 2013
  10. Jeff KingMar 2, 2013
  11. Andreas SchwabMar 2, 2013
  12. Junio C HamanoMar 3, 2013
  13. Jeff KingMar 3, 2013
  14. Jeff KingMar 3, 2013

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.