Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-27 Thread Taylor Blau
On Wed, Sep 26, 2018 at 02:38:53PM -0400, Jeff King wrote: > On Wed, Sep 26, 2018 at 06:39:56AM -0700, Taylor Blau wrote: > > > > A perl tangent if you're interested: > > [...] > > > > To be clear, we ought to leave this function as: > > > > extract_haves () { > > depacketize | perl -lne '/^(

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-26 Thread Jeff King
On Wed, Sep 26, 2018 at 06:39:56AM -0700, Taylor Blau wrote: > > A perl tangent if you're interested: > [...] > > To be clear, we ought to leave this function as: > > extract_haves () { > depacketize | perl -lne '/^(\S+) \.have/ and print $1' > } Yes, I agree. You cannot do the "$@" the

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-26 Thread Taylor Blau
On Tue, Sep 25, 2018 at 11:33:37PM -0400, Jeff King wrote: > On Tue, Sep 25, 2018 at 06:09:35PM -0700, Taylor Blau wrote: > > > > So I think this is fine (modulo that the grep and sed can be combined). > > > Yet another option would be to simply strip away everything except the > > > object id (whi

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-25 Thread Jeff King
On Tue, Sep 25, 2018 at 06:09:35PM -0700, Taylor Blau wrote: > > So I think this is fine (modulo that the grep and sed can be combined). > > Yet another option would be to simply strip away everything except the > > object id (which is all we care about), like: > > > > depacketize | perl -lne '/

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-25 Thread Jeff King
On Tue, Sep 25, 2018 at 06:06:06PM -0700, Taylor Blau wrote: > > > +extract_haves () { > > > + depacketize - | grep '\.have' | sed -e 's/\\0.*$//g' > > > +} > > > > Don't pipe grep into sed, especially when both the pattern to filter > > and the operation to perform are simple. > > > > I am not su

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-25 Thread Taylor Blau
On Sat, Sep 22, 2018 at 03:52:58PM -0400, Jeff King wrote: > On Sat, Sep 22, 2018 at 06:02:31PM +, brian m. carlson wrote: > > > On Fri, Sep 21, 2018 at 02:47:43PM -0400, Taylor Blau wrote: > > > +expect_haves () { > > > + printf "%s .have\n" $(git rev-parse $@) >expect > > > +} > > > + > > > +

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-25 Thread Taylor Blau
On Fri, Sep 21, 2018 at 02:09:08PM -0700, Junio C Hamano wrote: > Taylor Blau writes: > > > +core.alternateRefsCommand:: > > + When listing references from an alternate (e.g., in the case of > > ".have"), use > > It is not clear how (e.g.,...) connects to what is said in the > sentence. "When

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-25 Thread Taylor Blau
On Fri, Sep 21, 2018 at 04:18:03PM -0400, Eric Sunshine wrote: > On Fri, Sep 21, 2018 at 2:47 PM Taylor Blau wrote: > > When in a repository containing one or more alternates, Git would > > sometimes like to list references from its alternates. For example, 'git > > receive-pack' list the objects

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-23 Thread brian m. carlson
On Sat, Sep 22, 2018 at 03:52:58PM -0400, Jeff King wrote: > On Sat, Sep 22, 2018 at 06:02:31PM +, brian m. carlson wrote: > > > On Fri, Sep 21, 2018 at 02:47:43PM -0400, Taylor Blau wrote: > > > +expect_haves () { > > > + printf "%s .have\n" $(git rev-parse $@) >expect > > > +} > > > + > > >

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-22 Thread Jeff King
On Sat, Sep 22, 2018 at 06:02:31PM +, brian m. carlson wrote: > On Fri, Sep 21, 2018 at 02:47:43PM -0400, Taylor Blau wrote: > > +expect_haves () { > > + printf "%s .have\n" $(git rev-parse $@) >expect > > +} > > + > > +extract_haves () { > > + depacketize - | grep '\.have' | sed -e 's/\\0

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-22 Thread brian m. carlson
On Fri, Sep 21, 2018 at 02:47:43PM -0400, Taylor Blau wrote: > +expect_haves () { > + printf "%s .have\n" $(git rev-parse $@) >expect > +} > + > +extract_haves () { > + depacketize - | grep '\.have' | sed -e 's/\\0.*$//g' It looks like you're trying to match a NUL here in the sed expressio

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-21 Thread Jeff King
On Fri, Sep 21, 2018 at 03:23:40PM -0700, Junio C Hamano wrote: > >> > +git config receive.advertisealternates true && > >> > >> Hmph. Do we have code to support this configuration variable? > > > > Sorry, I should have caught that. Our existing solution is to disable > > alterna

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-21 Thread Junio C Hamano
Jeff King writes: > On Fri, Sep 21, 2018 at 02:09:08PM -0700, Junio C Hamano wrote: > >> > +test_expect_success 'setup' ' >> > + test_commit one && >> > + git update-ref refs/heads/a HEAD && >> > + test_commit two && >> > + git update-ref refs/heads/b HEAD && >> > + test_commit three && >> >

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-21 Thread Jeff King
On Fri, Sep 21, 2018 at 02:09:08PM -0700, Junio C Hamano wrote: > > +test_expect_success 'setup' ' > > + test_commit one && > > + git update-ref refs/heads/a HEAD && > > + test_commit two && > > + git update-ref refs/heads/b HEAD && > > + test_commit three && > > + git update-ref refs/

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-21 Thread Eric Sunshine
On Fri, Sep 21, 2018 at 2:47 PM Taylor Blau wrote: > When in a repository containing one or more alternates, Git would > sometimes like to list references from its alternates. For example, 'git > receive-pack' list the objects pointed to by alternate references as > special ".have" references. > [

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-21 Thread Junio C Hamano
Taylor Blau writes: > +core.alternateRefsCommand:: > + When listing references from an alternate (e.g., in the case of > ".have"), use It is not clear how (e.g.,...) connects to what is said in the sentence. "When advertising tips of available history from an alternate, use ..." without sa

Re: [PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-21 Thread Eric Sunshine
On Fri, Sep 21, 2018 at 2:47 PM Taylor Blau wrote: > When in a repository containing one or more alternates, Git would > sometimes like to list references from its alternates. For example, 'git > receive-pack' list the objects pointed to by alternate references as > special ".have" references. > [

[PATCH v2 2/3] transport.c: introduce core.alternateRefsCommand

2018-09-21 Thread Taylor Blau
When in a repository containing one or more alternates, Git would sometimes like to list references from its alternates. For example, 'git receive-pack' list the objects pointed to by alternate references as special ".have" references. Listing ".have" references is designed to make pushing changes