{"thread":{"id":"15102","subject":"[PATCH/RFC] feeding Maildir to git-am","startedAt":"2008-08-20T05:25:57Z","lastAt":"2008-08-20T13:03:43Z","messageCount":2,"participants":["Junio C Hamano","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"87795","messageId":"7vbpzotfyy.fsf@gitster.siamese.dyndns.org","threadId":"15102","inReplyTo":null,"subject":"[PATCH/RFC] feeding Maildir to git-am","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-08-20T05:25:57Z","receivedAt":"2008-08-20T05:25:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I do not use Maildir myself but people who do not know how Maildir look\nlike (including myself) would be left wondering why there is even no error\nmessage when giving a random directory full of format-patch output to am.\n\nI am wondering if something like this would be helpful...\n\n builtin-mailsplit.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git i/builtin-mailsplit.c w/builtin-mailsplit.c\nindex 71f3b3b..829abbb 100644\n--- i/builtin-mailsplit.c\n+++ w/builtin-mailsplit.c\n@@ -122,16 +122,17 @@ static int populate_maildir_list(struct string_list *list, const char *path)\n \tchar name[PATH_MAX];\n \tchar *subs[] = { \"cur\", \"new\", NULL };\n \tchar **sub;\n+\tint found = 0;\n \n \tfor (sub = subs; *sub; ++sub) {\n \t\tsnprintf(name, sizeof(name), \"%s/%s\", path, *sub);\n \t\tif ((dir = opendir(name)) == NULL) {\n \t\t\tif (errno == ENOENT)\n \t\t\t\tcontinue;\n-\t\t\terror(\"cannot opendir %s (%s)\", name, strerror(errno));\n-\t\t\treturn -1;\n+\t\t\treturn error(\"cannot opendir %s (%s)\", name, strerror(errno));\n \t\t}\n \n+\t\tfound = 1;\n \t\twhile ((dent = readdir(dir)) != NULL) {\n \t\t\tif (dent->d_name[0] == '.')\n \t\t\t\tcontinue;\n@@ -142,6 +143,8 @@ static int populate_maildir_list(struct string_list *list, const char *path)\n \t\tclosedir(dir);\n \t}\n \n+\tif (!found)\n+\t\treturn error(\"'%s' is not a Maildir (no 'cur' nor 'new' found)\", path);\n \treturn 0;\n }\n \n"},{"id":"87818","messageId":"20080820130342.GA6602@coredump.intra.peff.net","threadId":"15102","inReplyTo":"7vbpzotfyy.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH/RFC] feeding Maildir to git-am","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-08-20T13:03:43Z","receivedAt":"2008-08-20T13:03:43Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Aug 19, 2008 at 10:25:57PM -0700, Junio C Hamano wrote:\n\n> I do not use Maildir myself but people who do not know how Maildir look\n> like (including myself) would be left wondering why there is even no error\n> message when giving a random directory full of format-patch output to am.\n\nI don't use maildirs with git, but I have worked with them in the past,\nand I think your patch is definitely an improvement.\n\nHowever, I wonder if we could go one step further and just DWYM: if a\ndirectory has \"cur\" or \"new\", treat it like a maildir (IOW, look in\nthere for patches), but otherwise treat it like a directory of\nformat-patch output.\n\n-Peff\n"}]}