Re: [PATCH v2 13/27] ls-refs: introduce ls-refs server command

2018-02-02 Thread Brandon Williams
On 01/26, Stefan Beller wrote:
> On Thu, Jan 25, 2018 at 3:58 PM, Brandon Williams  wrote:
> 
> > +ls-refs takes in the following parameters wrapped in packet-lines:
> > +
> > +symrefs
> > +   In addition to the object pointed by it, show the underlying ref
> > +   pointed by it when showing a symbolic ref.
> > +peel
> > +   Show peeled tags.
> 
> Would it make sense to default these two to on, and rather have
> optional no-symrefs and no-peel ?
> 
> That would save bandwidth in the default case, I would think.

Maybe?  That would save sending those strings for each request

-- 
Brandon Williams


Re: [PATCH v2 13/27] ls-refs: introduce ls-refs server command

2018-01-26 Thread Stefan Beller
On Thu, Jan 25, 2018 at 3:58 PM, Brandon Williams  wrote:

> +ls-refs takes in the following parameters wrapped in packet-lines:
> +
> +symrefs
> +   In addition to the object pointed by it, show the underlying ref
> +   pointed by it when showing a symbolic ref.
> +peel
> +   Show peeled tags.

Would it make sense to default these two to on, and rather have
optional no-symrefs and no-peel ?

That would save bandwidth in the default case, I would think.

> +   cat >expect <<-EOF &&
> +   $(git rev-parse HEAD) HEAD
> +   $(git rev-parse refs/heads/dev) refs/heads/dev
> +   $(git rev-parse refs/heads/master) refs/heads/master
> +   $(git rev-parse refs/heads/release) refs/heads/release
> +   $(git rev-parse refs/tags/annotated-tag) refs/tags/annotated-tag
> +   $(git rev-parse refs/tags/one) refs/tags/one
> +   $(git rev-parse refs/tags/two) refs/tags/two

Invoking rev-parse quite a few times? I think the test suite is a
trade off between readability ("what we expect the test to do and test")
and speed (specifically on Windows forking is expensive);

I tried to come up with a more concise way to create this expectation
using git-rev-parse, but did not find a good way to do so.

However maybe

  git for-each-ref --format='%(*objectname) %(*refname)' >expect

might help in reproducing the expected message? The downside
of this would be to have to closely guard which refs are there though.
I guess the '--pattern' could help there as it may be the same pattern
as the input to the ls-refs. This might be too abstract for a test though.

I dunno.

Stefan