git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Teach mailsplit about Maildir's

From
FPFernando J. Pereda <ferdy@gentoo.org>
Date
May 24, 2007, 19:56 UTC
Message-ID
<20070524195608.GA4714@ferdyx.org>
In-Reply-To
<7vd50qvwaz.fsf@assigned-by-dhcp.cox.net>
On Thu, May 24, 2007 at 12:47:00PM -0700, Junio C Hamano wrote:
Show 9 quoted lines
> "Fernando J. Pereda" <ferdy@gentoo.org> writes:
> >           [--whitespace=<option>] [-C<n>] [-p<n>]
> > -         <mbox>...
> > +         <mbox>|<Maildir>...
> > +
> >  'git-am' [--skip | --resolved]
> 
> Does the document still format Ok if you add a blank line there
> (not a rhetorical question -- I haven't checked)?
I think I tried when I first sent it, will try.
Show 7 quoted lines
> > +
> > +	if ((dir = opendir(path)) == NULL) {
> > +		error("cannot diropen %s (%s)", path, strerror(errno));
> > +		return -1;
> > +	}
> 
> Didn't you just fail opendir, not diropen?
Ouch, will fix
> > +	return 1;
> > +}
> 
> Usually we signal success by returning 0.
Ok. Fair enough.
Show 17 quoted lines
> 
> > +static int split_maildir(const char *maildir, const char *dir,
> > +	int nr_prec, int skip)
> > +{
> > +	char file[PATH_MAX];
> > +	char curdir[PATH_MAX];
> > +	char name[PATH_MAX];
> >  	int ret = -1;
> > +	struct path_list list = {NULL, 0, 0, 1};
> >  
> > +	snprintf(curdir, sizeof(curdir), "%s/cur", maildir);
> > +	if (populate_maildir_list(&list, curdir) < 0)
> > +		goto out;
> >  
> > +	int i;
> 
> Decl-after-statement.

I did it because other parts of the file do it too. Do you want me to fix the rest of them?

Show 6 quoted lines
> 
> > +	for (i = 0; i < list.nr; i++) {
> > +		snprintf(file, sizeof(file), "%s/%s", curdir, list.items[i].path);
> > +		FILE *f = fopen(file, "r");
> 
> Likewise.

Again, because we were already doing it in other parts of the file. Will fix.

Show 17 quoted lines
> 
> > @@ -186,9 +249,39 @@ int cmd_mailsplit(int argc, const char **argv, const char *prefix)
> > ...
> > +		if (ret < 0) {
> > +			error("cannot split patches from %s", arg);
> > +			return 1;
> > +		}
> > +		num += ret;
> > +	}
> > +
> > +	printf("%d\n", num);
> >  
> > -	return ret == -1;
> > +	return 0;
> >  }
> 
> We do not signal error anymore from the command?

If we reached that part of the code, there is no error to signal about. We signal error when either split_mbox or split_maildir fail by returning 1.

Will fix those issues and send a new patch. Thanks for reviewing it.
- ferdy
-- 
Fernando J. Pereda Garcimartín
20BB BDC3 761A 4781 E6ED  ED0B 0A48 5B0C 60BD 28D4
Previous: Junio C HamanoNext: Junio C Hamano
Message 19 of 21 in “Teach mailsplit about Maildir's”
  1. Teach mailsplit about Maildir'sFernando J. Pereda, May 20, 2007
  2. Junio C HamanoMay 20, 2007
  3. Alex RiesenMay 20, 2007
  4. Fernando J. PeredaMay 20, 2007
  5. Alex RiesenMay 20, 2007
  6. Fernando J. PeredaMay 20, 2007
  7. Johan HerlandMay 20, 2007
  8. Fernando J. PeredaMay 20, 2007
  9. Johan HerlandMay 20, 2007
  10. Johannes SchindelinMay 21, 2007
  11. Junio C HamanoMay 21, 2007
  12. Johannes SchindelinMay 21, 2007
  13. Fernando J. PeredaMay 21, 2007
  14. Fernando J. PeredaMay 21, 2007
  15. Allow user to specify mailbox format for mailsplitAlex Riesen, May 21, 2007
  16. Junio C HamanoMay 21, 2007
  17. Alex RiesenMay 22, 2007
  18. Junio C HamanoMay 24, 2007
  19. Fernando J. PeredaMay 24, 2007
  20. Junio C HamanoMay 24, 2007
  21. Teach mailsplit about Maildir'sFernando J. Pereda, May 24, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.