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

Re: [PATCH] receive-pack: simplify run_update_post_hook()

From
Jeff King <peff@peff.net>
Date
Mar 20, 2017, 03:35 UTC
Message-ID
<20170320033530.sl4rbd2lq3qo2kgl@sigill.intra.peff.net>
In-Reply-To
<xmqqshma4ihk.fsf@gitster.mtv.corp.google.com>
On Sat, Mar 18, 2017 at 10:12:07AM -0700, Junio C Hamano wrote:
Show 18 quoted lines
> >> -	argv_array_push(&proc.args, hook);
> >>  	for (cmd = commands; cmd; cmd = cmd->next) {
> >>  		if (cmd->error_string || cmd->did_not_exist)
> >>  			continue;
> >> +		if (!proc.args.argc)
> >> +			argv_array_push(&proc.args, hook);
> >>  		argv_array_push(&proc.args, cmd->ref_name);
> >>  	}
> >> +	if (!proc.args.argc)
> >> +		return;
> >
> > It looks at first like the result leaks, because you have to realize
> > that the push will modify proc.args.argc. 
> 
> Hmph, I needed to read the original twice to imagine how a paranoid
> person can fear leaks.  The return condition says "if args array is
> empty, just return" and the thing being empty is an enough indication
> to think nothing is leaking, at least for me.
Yeah, I think I just read it funny the first time. I'm OK with it as-is.
-Peff
Previous: Junio C HamanoNext: Jonathan Nieder
Message 5 of 6 in “receive-pack: simplify run_update_post_hook()”
  1. receive-pack: simplify run_update_post_hook()René Scharfe, Mar 17, 2017
  2. Jeff KingMar 17, 2017
  3. René ScharfeMar 17, 2017
  4. Junio C HamanoMar 18, 2017
  5. Jeff KingMar 20, 2017
  6. Jonathan NiederMar 17, 2017

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.