Re: [PATCH 3/3] transport.c: introduce core.alternateRefsPrefixes
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Sep 21, 2018, 17:49 UTC
- Message-ID
- <20180921174923.GB17718@syl>
- In-Reply-To
- <xmqqfty2x0iw.fsf@gitster-ct.c.googlers.com>
On Fri, Sep 21, 2018 at 09:45:11AM -0700, Junio C Hamano wrote:
Show 24 quoted lines
> Taylor Blau <me@ttaylorr.com> writes:
>
> > ...' block with your suggestion above. It's tempting to introduce it as:
> >
> > expect_haves() {
> > printf "%s .have\n" $(git rev-parse -- $@)
> > }
> >
> > And call it as:
> >
> > expect_haves one three two >expect
> >
> > But I'm not sure whether I think that this is better or worse than
> > writing it twice inline.
>
> If the expected pattern is expected to stay to be just a sequence of
> "<oid> .have" and nothing else for the foreseeable future, I think
> it is a good idea to introduce such a helper function. Spelling it
> out at the use site, e.g.
>
> printf "%s .have\n" $(git rev-parse a b c) >expect
>
> will become cumbersome once the set of objects you need to show
> starts growing.That's a good reason, and I hadn't thought of it.
Show 5 quoted lines
> expect_haves a b c >expect > > would be shorter, of course. And as long as we expect to have ONLY > "<oid> .have" lines and nothing else, there is no downside that the > details of the format is hidden away inside the helper.
Yeah, I don't expect this to to change much at all, so I think that 'expect_haves()' is good.
Thanks, Taylor