git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	William Giokas <1007380@gmail.com>,
	git@vger.kernel.org
Subject: Re: [bug report] git-am applying maildir patches in reverse
Date: Sun, 3 Mar 2013 01:32:44 -0500	[thread overview]
Message-ID: <20130303063244.GB23221@sigill.intra.peff.net> (raw)
In-Reply-To: <7vtxotc895.fsf@alter.siamese.dyndns.org>

On Sat, Mar 02, 2013 at 10:22:46PM -0800, Junio C Hamano wrote:

> 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

  reply	other threads:[~2013-03-03  6:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 22:20 [bug report] git-am applying maildir patches in reverse William Giokas
2013-03-01 22:27 ` Junio C Hamano
2013-03-01 22:52   ` Jeff King
2013-03-01 23:05     ` Jeff King
2013-03-01 23:24       ` Junio C Hamano
2013-03-01 23:35         ` Jeff King
2013-03-01 23:57           ` Junio C Hamano
2013-03-02  0:38             ` Jeff King
2013-03-02  0:08           ` Junio C Hamano
2013-03-02  0:41             ` Jeff King
2013-03-02  8:44               ` Andreas Schwab
2013-03-03  6:22                 ` Junio C Hamano
2013-03-03  6:32                   ` Jeff King [this message]
2013-03-03  6:26                 ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130303063244.GB23221@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=1007380@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).