Subject: Re: [PATCH 2/3] cmd_push: pass "flags" pointer to config callback

From: Jeff King <[email-masked]>
Date: Mon, 16 Feb 2015 02:16:39 -0500

On Sun, Feb 15, 2015 at 11:05:57PM -0800, Junio C Hamano wrote:

> Jeff King <[email-masked]> writes:
> 
> > This will let us manipulate any transport flags which have matching
> > config options (there are none yet, but we will add one in
> > the next patch).
> 
> Nice---this will later lets us do push.atomic if we really wanted
> to, right?

Yes, exactly. Or push.signed, or whatever.

> > To be honest, the whole do_push is confusing to me. It seems like that
> > should just be part of cmd_push.
> 
> Yeah, that part of the push callchain always confuses me every time
> I look at it.  I think it was a consequence of how transport layer
> was wedged into the existing codepath that only handled push that
> called send-pack to unify the codepaths that push calls into
> different transport backends, and we may have done it differently
> and more cleanly if we were designing the push to transport to
> backends from scratch.

I took a very cursory look at folding do_push into cmd_push. It's not
_too_ bad. You wouldn't want to fold push_with_options in, as that gets
called from a loop (you could make it the loop body, but I think it is
more clear as-is).

However, it is really do_push which continues to manipulate the flags
and set up the push, so that is the bit that should be folded in. And
then it would be fine to make transport_flags a global, and
push_with_options could just use it directly, I think.

-Peff