[PATCH/RFC] feeding Maildir to git-am

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
 }
 
--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux