git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH/RFC] feeding Maildir to git-am
Date: Tue, 19 Aug 2008 22:25:57 -0700	[thread overview]
Message-ID: <7vbpzotfyy.fsf@gitster.siamese.dyndns.org> (raw)

I do not use Maildir myself but people who do not know how Maildir look
like (including myself) would be left wondering why there is even no error
message when giving a random directory full of format-patch output to am.

I am wondering if something like this would be helpful...

 builtin-mailsplit.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git i/builtin-mailsplit.c w/builtin-mailsplit.c
index 71f3b3b..829abbb 100644
--- i/builtin-mailsplit.c
+++ w/builtin-mailsplit.c
@@ -122,16 +122,17 @@ static int populate_maildir_list(struct string_list *list, const char *path)
 	char name[PATH_MAX];
 	char *subs[] = { "cur", "new", NULL };
 	char **sub;
+	int found = 0;
 
 	for (sub = subs; *sub; ++sub) {
 		snprintf(name, sizeof(name), "%s/%s", path, *sub);
 		if ((dir = opendir(name)) == NULL) {
 			if (errno == ENOENT)
 				continue;
-			error("cannot opendir %s (%s)", name, strerror(errno));
-			return -1;
+			return error("cannot opendir %s (%s)", name, strerror(errno));
 		}
 
+		found = 1;
 		while ((dent = readdir(dir)) != NULL) {
 			if (dent->d_name[0] == '.')
 				continue;
@@ -142,6 +143,8 @@ static int populate_maildir_list(struct string_list *list, const char *path)
 		closedir(dir);
 	}
 
+	if (!found)
+		return error("'%s' is not a Maildir (no 'cur' nor 'new' found)", path);
 	return 0;
 }
 

             reply	other threads:[~2008-08-20  5:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20  5:25 Junio C Hamano [this message]
2008-08-20 13:03 ` [PATCH/RFC] feeding Maildir to git-am Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vbpzotfyy.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).