Skip to contentSkip to conversation

Teach mailsplit about Maildir

PATCH In review Fernando J. Pereda 2 participants 2 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Teach mailsplit about Maildir

---

This time I changed the documentation of git-am and git-mailsplit to state that it can also split Maildirs.

Instead of taking an arbitrary order (like my last patch) it now relies on filenames to be sorted. Although the Maildir 'spec' prohibits it, at leas

 Documentation/git-am.txt        |    7 +-
 Documentation/git-mailsplit.txt |   11 +++-
 builtin-mailsplit.c             |  122 ++++++++++++++++++++++++++++++++------
 builtin.h                       |    2 +-
 4 files changed, 115 insertions(+), 27 deletions(-)
Documentation/git-am.txt +4 -3
index f0405a3..3b392f0 100644
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git-am' [--signoff] [--dotest=<dir>] [--utf8 | --no-utf8] [--binary] [--3way]
          [--interactive] [--whitespace=<option>] [-C<n>] [-p<n>]
-	 <mbox>...
+	 <mbox>|<Maildir>...
 'git-am' [--skip | --resolved]
 
 DESCRIPTION
@@ -22,9 +22,10 @@ current branch.
 
 OPTIONS
 -------
-<mbox>...::
+<mbox>|<Maildir>...::
 	The list of mailbox files to read patches from. If you do not
-	supply this argument, reads from the standard input.
+	supply this argument, reads from the standard input. If you supply
+	directories, they'll be treated as Maildirs.
 
 -s, --signoff::
 	Add `Signed-off-by:` line to the commit message, using
Documentation/git-mailsplit.txt +8 -3
index c11d6a5..35a74b8 100644
@@ -7,12 +7,12 @@ git-mailsplit - Simple UNIX mbox splitter program
 
 SYNOPSIS
 --------
-'git-mailsplit' [-b] [-f<nn>] [-d<prec>] -o<directory> [--] [<mbox>...]
+'git-mailsplit' [-b] [-f<nn>] [-d<prec>] -o<directory> [--] [<mbox>|<Maildir>...]
 
 DESCRIPTION
 -----------
-Splits a mbox file into a list of files: "0001" "0002" ..  in the specified
-directory so you can process them further from there.
+Splits a mbox file or a Maildir into a list of files: "0001" "0002" ..  in the
+specified directory so you can process them further from there.
 
 OPTIONS
 -------
@@ -20,6 +20,11 @@ OPTIONS
 	Mbox file to split.  If not given, the mbox is read from
 	the standard input.
 
+<Maildir>::
+	Root of the Maildir to split. This directory should contain the cur, tmp
+	and new subdirectories. git-mailsplit relies on filenames being sorted to
+	output patches in the correct order.
+
 <directory>::
 	Directory in which to place the individual messages.
 
builtin-mailsplit.c +102 -20

162 lines not on this page · raw message

builtin.h +1 -1
index d3f3a74..39290d1 100644
@@ -8,7 +8,7 @@ extern const char git_usage_string[];
 
 extern void help_unknown_cmd(const char *cmd);
 extern int mailinfo(FILE *in, FILE *out, int ks, const char *encoding, const char *msg, const char *patch);
-extern int split_mbox(const char **mbox, const char *dir, int allow_bare, int nr_prec, int skip);
+extern int split_mbox(const char *file, const char *dir, int allow_bare, int nr_prec, int skip);
 extern void stripspace(FILE *in, FILE *out);
 extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
 extern void prune_packed_objects(int);
Signature · 1 line
1.5.1.2
#1 lore raw
Quoted 9 lines · Fernando J. Pereda

---

This time I changed the documentation of git-am and git-mailsplit to state that it can also split Maildirs.

Instead of taking an arbitrary order (like my last patch) it now relies on filenames to be sorted. Although the Maildir 'spec' prohibits it, at leas

... at least we found that Pine and Mutt are generating 'sorted filenames'.

Hit 'send' too early.

- ferdy