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

Re: Maildir ordering in git-mailsplit (was: Using mutt as a git maintainer)

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 7, 2010, 13:23 UTC
Message-ID
<m3eieao8uh.fsf@localhost.localdomain>
In-Reply-To
<20100807112159.GA12015@sceen.net>
Richard Braun <rbraun@sceen.net> writes:
Show 23 quoted lines
> On Sat, Aug 07, 2010 at 08:13:39AM +0530, Ramkumar Ramachandra wrote:
> > 
> > Ah, it looks like this problem went unnoticed probably because
> > everyone uses mboxes. One possible solution would be to teach
> > `git-mailsplit` to order the emails correctly. You can reply with an
> > RFC patch; I've CC'ed the Git list on this email.
> 
> Well, if everybody else has survived for five years with mbox patch
> series, I guess I can do that too. With some not-so-difficult work, I
> managed to have Mutt do what I wanted (that is, saving patch series in
> mbox files in one macro and keep everything else with Maildir folders
> untouched).
> 
> After some digging in the code, it doesn't look like a git issue. When
> a Maildir folder is processed, its entries are actually sorted, unlike
> what I first thought. populate_maildir_list() calls string_list_insert()
> (in string-list.c) which does insertion sort through its static
> add_entry() and get_entry_index() functions which use a bare strcmp() to
> compare file names (it was path-list.c back in Git 1.5, same code).
> When copying a threaded patch series in a Maildir folder with Mutt, here
> are the names created:
> 1281177008.8677_101.myhostname:2,
> 1281177008.8677_103.myhostname:2,
[...]
Show 17 quoted lines
> 1281177008.8677_11.myhostname:2,
> 1281177008.8677_13.myhostname:2,
> 1281177008.8677_15.myhostname:2,
> 1281177008.8677_17.myhostname:2,
> 1281177008.8677_19.myhostname:2,
> 1281177008.8677_1.myhostname:2,
> 1281177008.8677_21.myhostname:2,
> 1281177008.8677_23.myhostname:2,
> 
> And for such names, git am determines that e.g.
> "1281177008.8677_107.myhostname:2", should be applied before
> "1281177008.8677_17.myhostname:2,", which is obviously wrong.
> 
> I'm not sure about what depends on string-list.c, but based on the
> output of a raw grep, it doesn't seem like a good idea to change the
> way strings are sorted, especially if almost noone uses Maildir for
> patch series. [...]

Would it be really that difficult to implement "version sort" in git (like 'ls -v' / 'ls --sort=version' does), using strverscmp (and provide fallback in compat/), and use it in git-am?

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Richard BraunNext: Nicolas Sebrecht
Message 3 of 4 in “Maildir ordering in git-mailsplit (was: Using mutt as a git maintainer)”
  1. Ramkumar RamachandraAug 7, 2010
  2. Richard BraunAug 7, 2010
  3. Jakub NarebskiAug 7, 2010
  4. Nicolas SebrechtAug 10, 2010

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.