git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-mailsplit: with maildirs try to process new/ if cur/ is empty
@ 2007-10-26 14:15 Gerrit Pape
  2007-10-26 16:01 ` Fernando J. Pereda
  0 siblings, 1 reply; 20+ messages in thread
From: Gerrit Pape @ 2007-10-26 14:15 UTC (permalink / raw)
  To: git, Junio C Hamano

When saving patches to a maildir with e.g. mutt, the files are put into
the new/ subdirectory of the maildir, not cur/.  This makes git-am state
"Nothing to do.".  This patch lets git-mailsplit fallback to new/ if the
cur/ subdirectory is empty.

This was reported by Joey Hess through
 http://bugs.debian.org/447396

Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 Documentation/git-am.txt |    3 ++-
 builtin-mailsplit.c      |    5 +++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt
index e4a6b3a..49f79f6 100644
--- a/Documentation/git-am.txt
+++ b/Documentation/git-am.txt
@@ -26,7 +26,8 @@ OPTIONS
 <mbox>|<Maildir>...::
 	The list of mailbox files to read patches from. If you do not
 	supply this argument, reads from the standard input. If you supply
-	directories, they'll be treated as Maildirs.
+	directories, they'll be treated as Maildirs, which should contain
+	the patches either in the cur/ subdirectory, or in new/.
 
 -s, --signoff::
 	Add `Signed-off-by:` line to the commit message, using
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index 43fc373..eaf3cbe 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -131,6 +131,11 @@ static int split_maildir(const char *maildir, const char *dir,
 	snprintf(curdir, sizeof(curdir), "%s/cur", maildir);
 	if (populate_maildir_list(&list, curdir) < 0)
 		goto out;
+	if (list.nr == 0) {
+		snprintf(curdir, sizeof(curdir), "%s/new", maildir);
+		if (populate_maildir_list(&list, curdir) < 0)
+			goto out;
+	}
 
 	for (i = 0; i < list.nr; i++) {
 		FILE *f;
-- 
1.5.3.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2007-11-08  7:31 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 14:15 [PATCH] git-mailsplit: with maildirs try to process new/ if cur/ is empty Gerrit Pape
2007-10-26 16:01 ` Fernando J. Pereda
2007-11-05 12:49   ` Gerrit Pape
2007-11-05 12:58     ` Jakub Narebski
2007-11-05 21:26     ` Jeff King
2007-11-05 22:52     ` Alex Riesen
2007-11-06  1:41       ` Michael Cohen
2007-11-06  7:28         ` Alex Riesen
2007-11-06  7:51           ` Jeff King
2007-11-06 11:01             ` Johannes Schindelin
2007-11-06 15:47               ` Jeff King
2007-11-06 15:51                 ` Johannes Schindelin
2007-11-06 16:35                   ` Karl Hasselström
2007-11-06 16:58                     ` Johannes Schindelin
2007-11-06 21:50                     ` Alex Riesen
2007-11-06  8:54       ` [PATCH amend] git-mailsplit: with maildirs not only process cur/, but also new/ Gerrit Pape
2007-11-08  2:09         ` Junio C Hamano
2007-11-08  2:31           ` Jeff King
2007-11-08  7:24           ` Alex Riesen
2007-11-08  7:31           ` Fernando J. Pereda

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 NNTP newsgroup(s).