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@xxxxxxxxxxx> --- 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html