{"thread":{"id":"24656","subject":"Maildir ordering in git-mailsplit (was: Using mutt as a git maintainer)","startedAt":"2010-08-07T02:43:39Z","lastAt":"2010-08-10T17:54:11Z","messageCount":4,"participants":["Ramkumar Ramachandra","Richard Braun","Jakub Narebski","Nicolas Sebrecht"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"147367","messageId":"20100807024337.GA15410@kytes","threadId":"24656","inReplyTo":"20100806222847.GA4240@sceen.net","subject":"Maildir ordering in git-mailsplit (was: Using mutt as a git maintainer)","fromName":"Ramkumar Ramachandra","fromEmail":"artagnon@gmail.com","sentAt":"2010-08-07T02:43:39Z","receivedAt":"2010-08-07T02:43:39Z","isPatch":false,"sender":{"key":"r@artagnon.com","avatar":"https://avatars.githubusercontent.com/u/37226?v=4"},"body":"Hi Richard,\n\nRichard Braun writes:\n> I'm currently setting up several git repositories, both for personal stuff\n> and at work, and I also am an avid Mutt user. But I have a problem with the\n> \"braindamaged\" git-mailsplit program and how it interacts badly with how\n> Mutt does some things.\n> \n> The specific case that troubles me is when using git send-email with several\n> patches, say around 10, then getting those in my lovely Mutt as one thread,\n> with chainreplyto set to false because i'm a nice person who RTFM. Until now\n> everything looks perfect. Then I tag the thread and copy it out to a\n> temporary mailbox so that I can run git am and do something else with my\n> life. Problem: I use Maildir mailboxes, and with several files, mutt doesn't\n> preserve the order of the patches. As git-mailsplit uses a raw opendir()\n> to access patches in Maildir format, and doesn't try to sort anything after,\n> some patch series just won't apply simply.\n\nAh, it looks like this problem went unnoticed probably because\neveryone uses mboxes. One possible solution would be to teach\n`git-mailsplit` to order the emails correctly. You can reply with an\nRFC patch; I've CC'ed the Git list on this email.\n\n> I'm using git 1.5.6.5 and Mutt 1.5.18 (from Debian lenny), pretty old but\n> after checking the most recent source code, it just seems to be the same.\n\nYeah, I don't think git-mailsplit has changed in some time.\n\n-- Ram\n"},{"id":"147384","messageId":"20100807112159.GA12015@sceen.net","threadId":"24656","inReplyTo":"20100807024337.GA15410@kytes","subject":"Re: Maildir ordering in git-mailsplit (was: Using mutt as a git maintainer)","fromName":"Richard Braun","fromEmail":"rbraun@sceen.net","sentAt":"2010-08-07T11:21:59Z","receivedAt":"2010-08-07T11:21:59Z","isPatch":false,"sender":{"key":"rbraun@sceen.net","avatar":null},"body":"On Sat, Aug 07, 2010 at 08:13:39AM +0530, Ramkumar Ramachandra wrote:\n> Hi Richard,\n> \n> Ah, it looks like this problem went unnoticed probably because\n> everyone uses mboxes. One possible solution would be to teach\n> `git-mailsplit` to order the emails correctly. You can reply with an\n> RFC patch; I've CC'ed the Git list on this email.\n\nWell, if everybody else has survived for five years with mbox patch\nseries, I guess I can do that too. With some not-so-difficult work, I\nmanaged to have Mutt do what I wanted (that is, saving patch series in\nmbox files in one macro and keep everything else with Maildir folders\nuntouched).\n\nAfter some digging in the code, it doesn't look like a git issue. When\na Maildir folder is processed, its entries are actually sorted, unlike\nwhat I first thought. populate_maildir_list() calls string_list_insert()\n(in string-list.c) which does insertion sort through its static\nadd_entry() and get_entry_index() functions which use a bare strcmp() to\ncompare file names (it was path-list.c back in Git 1.5, same code).\nWhen copying a threaded patch series in a Maildir folder with Mutt, here\nare the names created:\n1281177008.8677_101.myhostname:2,\n1281177008.8677_103.myhostname:2,\n1281177008.8677_105.myhostname:2,\n1281177008.8677_107.myhostname:2,\n1281177008.8677_109.myhostname:2,\n1281177008.8677_111.myhostname:2,\n1281177008.8677_113.myhostname:2,\n1281177008.8677_11.myhostname:2,\n1281177008.8677_13.myhostname:2,\n1281177008.8677_15.myhostname:2,\n1281177008.8677_17.myhostname:2,\n1281177008.8677_19.myhostname:2,\n1281177008.8677_1.myhostname:2,\n1281177008.8677_21.myhostname:2,\n1281177008.8677_23.myhostname:2,\n\nAnd for such names, git am determines that e.g.\n\"1281177008.8677_107.myhostname:2\", should be applied before\n\"1281177008.8677_17.myhostname:2,\", which is obviously wrong.\n\nI'm not sure about what depends on string-list.c, but based on the\noutput of a raw grep, it doesn't seem like a good idea to change the\nway strings are sorted, especially if almost noone uses Maildir for\npatch series. The best solution IMO would be a Mutt hook to alter the\nfile names or something like that. A good workaround is configuring it\nto use mbox as the default format and keep existing folders as Maildirs\n(that's what I'm doing now). I guess the only file to patch in any case\nis Documentation/SubmittingPatches, adding an entry for Mutt in the MUA\nhints part (if possible with the renaming hook if someone knows how to\ndo that - I'll search a bit on my side - or with an explanation of the\nissue and the simple mbox workaround).\n\n-- \nRichard Braun\n"},{"id":"147388","messageId":"m3eieao8uh.fsf@localhost.localdomain","threadId":"24656","inReplyTo":"20100807112159.GA12015@sceen.net","subject":"Re: Maildir ordering in git-mailsplit (was: Using mutt as a git maintainer)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-08-07T13:23:46Z","receivedAt":"2010-08-07T13:23:46Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Richard Braun <rbraun@sceen.net> writes:\n> On Sat, Aug 07, 2010 at 08:13:39AM +0530, Ramkumar Ramachandra wrote:\n> > \n> > Ah, it looks like this problem went unnoticed probably because\n> > everyone uses mboxes. One possible solution would be to teach\n> > `git-mailsplit` to order the emails correctly. You can reply with an\n> > RFC patch; I've CC'ed the Git list on this email.\n> \n> Well, if everybody else has survived for five years with mbox patch\n> series, I guess I can do that too. With some not-so-difficult work, I\n> managed to have Mutt do what I wanted (that is, saving patch series in\n> mbox files in one macro and keep everything else with Maildir folders\n> untouched).\n> \n> After some digging in the code, it doesn't look like a git issue. When\n> a Maildir folder is processed, its entries are actually sorted, unlike\n> what I first thought. populate_maildir_list() calls string_list_insert()\n> (in string-list.c) which does insertion sort through its static\n> add_entry() and get_entry_index() functions which use a bare strcmp() to\n> compare file names (it was path-list.c back in Git 1.5, same code).\n> When copying a threaded patch series in a Maildir folder with Mutt, here\n> are the names created:\n> 1281177008.8677_101.myhostname:2,\n> 1281177008.8677_103.myhostname:2,\n[...]\n> 1281177008.8677_11.myhostname:2,\n> 1281177008.8677_13.myhostname:2,\n> 1281177008.8677_15.myhostname:2,\n> 1281177008.8677_17.myhostname:2,\n> 1281177008.8677_19.myhostname:2,\n> 1281177008.8677_1.myhostname:2,\n> 1281177008.8677_21.myhostname:2,\n> 1281177008.8677_23.myhostname:2,\n> \n> And for such names, git am determines that e.g.\n> \"1281177008.8677_107.myhostname:2\", should be applied before\n> \"1281177008.8677_17.myhostname:2,\", which is obviously wrong.\n> \n> I'm not sure about what depends on string-list.c, but based on the\n> output of a raw grep, it doesn't seem like a good idea to change the\n> way strings are sorted, especially if almost noone uses Maildir for\n> patch series. [...]\n\nWould it be really that difficult to implement \"version sort\" in git\n(like 'ls -v' / 'ls --sort=version' does), using strverscmp (and\nprovide fallback in compat/), and use it in git-am?\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"147662","messageId":"20100810175411.GA13084@vidovic","threadId":"24656","inReplyTo":"m3eieao8uh.fsf@localhost.localdomain","subject":"Re: Maildir ordering in git-mailsplit (was: Using mutt as a git maintainer)","fromName":"Nicolas Sebrecht","fromEmail":"nicolas.s.dev@gmx.fr","sentAt":"2010-08-10T17:54:11Z","receivedAt":"2010-08-10T17:54:11Z","isPatch":false,"sender":{"key":"nicolas.s.dev@gmx.fr","avatar":null},"body":"The 07/08/10, Jakub Narebski wrote:\n> Richard Braun <rbraun@sceen.net> writes:\n> > \n> > I'm not sure about what depends on string-list.c, but based on the\n> > output of a raw grep, it doesn't seem like a good idea to change the\n> > way strings are sorted, especially if almost noone uses Maildir for\n> > patch series. [...]\n\nI do use maildir but never hit this problem (or never seen it, at least)\nprobably because I often purge the maildir \"_patches\" where I store\npatch series.\n\n> Would it be really that difficult to implement \"version sort\" in git\n> (like 'ls -v' / 'ls --sort=version' does), using strverscmp (and\n> provide fallback in compat/), and use it in git-am?\n\nYeah, it would be nice to fix this bug. I don't have time these days but\nI'm marking this thread to look further later.\n\n-- \nNicolas Sebrecht\n"}]}