Re: [PATCH 04/12] remote.c: provide per-branch pushremote name
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- May 5, 2015, 19:48 UTC
- Message-ID
- <CAPig+cQ+AbgTXAWKaN4obdGLWFDxjfr4yAaJZgvnLLzzoqdPRQ@mail.gmail.com>
- In-Reply-To
- <20150505193339.GF10463@peff.net>
On Tue, May 5, 2015 at 3:33 PM, Jeff King <peff@peff.net> wrote:
Show 17 quoted lines
> On Sun, May 03, 2015 at 12:51:13AM -0400, Eric Sunshine wrote: > >> > Versus v1, I did something a little clever by passing a function pointer >> > around (versus a flag and letting the caller do a conditional based on >> > the flag). Too clever? >> >> FWIW: I found this "clever" version easy enough to follow. >> >> However, if you push a tiny bit of the work into the callers of >> remote_get_1(), then you can do away with the "cleverness" altogether, >> can't you? Something like this: > > Yeah, it's just that it goes in the opposite direction I was trying for, > which is to have as little code as possible in the wrapper functions (in > fact, I think after my changes you could even bump the read_config() > call into remote_get_1; before my changes, it depended on the pushremote > config being set before the call).
I also noticed that read_config() could be moved into remote_get_1(). In fact, with that change, then the wrappers really do collapse nicely to 1-liners, so the "clever" function pointer approach probably is cleaner; and it's nicely generalized over the previous round with the boolean argument to remote_get_1().