feeding Maildir to git-am
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(-)
builtin-mailsplit.c +5 -2
@@ -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 ; }
Quoted 3 lines · Junio C Hamano
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 don't use maildirs with git, but I have worked with them in the past, and I think your patch is definitely an improvement.
However, I wonder if we could go one step further and just DWYM: if a directory has "cur" or "new", treat it like a maildir (IOW, look in there for patches), but otherwise treat it like a directory of format-patch output.
-Peff