Subject: Re: [PATCHv4 00/21] git notes merge

From: Johan Herland <[email-masked]>
Date: Fri, 22 Oct 2010 17:41:25 +0200

On Thursday 21 October 2010, Sverre Rabbelier wrote:
> On Wed, Oct 20, 2010 at 21:08, Johan Herland wrote:
> > - Fetching and pushing note refs:
> >  - Add refs/notes/* to default fetch refspec?
> >  - A way to specify (at clone time) which refspec(s) to set up?
> >  - A way for the remote repo to hint at which refspecs you might
> > want to set up (by default?)
>
> Didn't we already discuss this earlier? Can you summarize (or at
> least link to) that discussion?

Yes, sorry for not answering you earlier. Here's what you wrote in the 
previous thread:

On Saturday 09 October 2010, Sverre Rabbelier wrote:
> Heya,
>
> On Sat, Oct 9, 2010 at 03:08, Johan Herland <[email-masked]> wrote:
> > - Fetching and pushing note refs:
> >  - Add refs/notes/* to default fetch refspec?
>
> Or at least add a '--notes[=<notes namespace>]' to fetch, pull, and
> push.

Agreed, at least that.

In order to promote sharing of notes, though, I'd like for it to be 
possible to configure the repo so that a vanilla 'git fetch' also 
updates your notes. In fact, I wonder if this should even be made the 
default.

> >  - A way to specify (at clone time) which refspec(s) to set up?
>
> How would that look like?

Maybe add an option to 'git clone' (and 'git remote add') that specifies 
the refspec you want to use in your config for that remote. Something 
like:

  git clone --fetch="+refs/heads/*:refs/remotes/origin/*" \
            --fetch="+refs/notes/*:refs/remotes/origin/notes/*" \
            <source_url> ...

...will set up the following config:

  [remote "origin"]
        url = <source_url>
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = +refs/notes/*:refs/remotes/origin/notes/*

Obviously, we would probably want to provide shorthands for the most 
common refspecs, like:

  git clone --fetch=default,notes <source_url> ...

or

  git clone --fetch-heads --fetch-notes <source_url> ...

> >  - A way for the remote repo to hint at which refspecs you might
> > want to set up (by default?)
>
> I assume this would be a generic mechanism of sorts? Are there any
> other use cases for this other than notes?

Yes, I believe so (although I haven't thought much about this, yet). 
There's been earlier discussions on hiding certain branches from view. 
This could maybe be solved by the server suggesting a refspec that 
excludes the stuff you don't want to share (by default). Similary, the 
refspec could _include_ notes namespaces that you do want to share.

Of course (as today) the client should be free to demand a different 
refspec, e.g. if it wants access to everything, or if it's only 
interested in a subset of the "default" refs.

...Johan

-- 
Johan Herland, <[email-masked]>
www.herland.net