Re: [bug report] git-am applying maildir patches in reverse

2013-03-02 Thread Jeff King
On Sat, Mar 02, 2013 at 10:22:46PM -0800, Junio C Hamano wrote: > Andreas Schwab 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

Re: [bug report] git-am applying maildir patches in reverse

2013-03-02 Thread Jeff King
On Sat, Mar 02, 2013 at 09:44:39AM +0100, Andreas Schwab wrote: > > + return *a - *b; > > You should always cast to unsigned char when determining the order of > characters, to be consistent with strcmp/memcmp. Thanks, I hadn't heard that advice before, but it makes obvious sense. Junio, do yo

Re: [bug report] git-am applying maildir patches in reverse

2013-03-02 Thread Junio C Hamano
Andreas Schwab 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 loo

Re: [bug report] git-am applying maildir patches in reverse

2013-03-02 Thread Andreas Schwab
Jeff King writes: > static int maildir_filename_cmp(const char *a, const char *b) > { > - while (1) { > + while (*a && *b) { > if (isdigit(*a) && isdigit(*b)) { > long int na, nb; > na = strtol(a, (char **)&a, 10); > @@ -148,6 +1

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Jeff King
On Fri, Mar 01, 2013 at 04:08:04PM -0800, Junio C Hamano wrote: > > +static int maildir_filename_cmp(const char *a, const char *b) > > +{ > > + while (1) { > > It is somewhat funny that we do not need to check !*a or !*b in this > loop. As long as readdir() does not return duplicates, we won't

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Jeff King
On Fri, Mar 01, 2013 at 03:57:39PM -0800, Junio C Hamano wrote: > > The epoch_seconds are the time of writing into the maildir. They will > > typically all be the same, unless your system is very slow, or you are > > writing a really long patch series. The PID likewise should be the same > > for a

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Junio C Hamano
Jeff King writes: > diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c > index 2d43278..772c668 100644 > --- a/builtin/mailsplit.c > +++ b/builtin/mailsplit.c > @@ -130,6 +130,26 @@ static int populate_maildir_list(struct string_list > *list, const char *path) > return 0; > } > > +s

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Junio C Hamano
Jeff King writes: > On Fri, Mar 01, 2013 at 03:24:42PM -0800, Junio C Hamano wrote: > >> Jeff King writes: >> >> > On Fri, Mar 01, 2013 at 05:52:31PM -0500, Jeff King wrote: >> > ... >> >> The maildir spec explicitly says that readers should not make >> >> assumptions about the content of the f

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Jeff King
On Fri, Mar 01, 2013 at 03:24:42PM -0800, Junio C Hamano wrote: > Jeff King writes: > > > On Fri, Mar 01, 2013 at 05:52:31PM -0500, Jeff King wrote: > > ... > >> The maildir spec explicitly says that readers should not make > >> assumptions about the content of the filenames. Mutt happens to wri

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Junio C Hamano
Jeff King writes: > On Fri, Mar 01, 2013 at 05:52:31PM -0500, Jeff King wrote: > ... >> The maildir spec explicitly says that readers should not make >> assumptions about the content of the filenames. Mutt happens to write >> them as: >> >> ${epoch_seconds}.${pid}_${seq}.${host} >> >> so in p

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Jeff King
On Fri, Mar 01, 2013 at 05:52:31PM -0500, Jeff King wrote: > > Note to bystanders. This is coming from populate_maildir_list() in > > builtin/mailsplit.c; the function claims to know what "maildir" > > should look like, so it should be enforcing the ordering as > > necessary by sorting the list,

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Jeff King
On Fri, Mar 01, 2013 at 02:27:32PM -0800, Junio C Hamano wrote: > > I've been using git for a while and this is the first time I've had to > > use `git am` and I've got a 16 patch patchset that I'm looking to apply. > > The files were copied to a separate maildir by mutt to keep things > > clean,

Re: [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread Junio C Hamano
William Giokas <1007...@gmail.com> writes: > All, > > I've been using git for a while and this is the first time I've had to > use `git am` and I've got a 16 patch patchset that I'm looking to apply. > The files were copied to a separate maildir by mutt to keep things > clean, and then I ran `git

[git] [bug report] git-am applying maildir patches in reverse

2013-03-01 Thread William Giokas
All, I've been using git for a while and this is the first time I've had to use `git am` and I've got a 16 patch patchset that I'm looking to apply. The files were copied to a separate maildir by mutt to keep things clean, and then I ran `git am -i /path/to/maildir/` expecting things to start from