git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Herland <johan@herland.net>
To: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Cc: Sverre Rabbelier <srabbelier@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, Jeff King <peff@peff.net>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	git@vger.kernel.org, Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: Q: how can i find the upstream merge point of a commit?
Date: Tue, 14 Jun 2011 11:56:56 +0200	[thread overview]
Message-ID: <201106141156.56320.johan@herland.net> (raw)
In-Reply-To: <BANLkTimtxESnZ23tRBYYVN1paUmNOhdPyw@mail.gmail.com>

On Wednesday 08 June 2011, Nguyen Thai Ngoc Duy wrote:
> 2011/6/8 Sverre Rabbelier <srabbelier@gmail.com>:
> > Heya,
> > 
> > [+Peff, Duy, who seemed interested in this]
> > 
> > On Wed, Jun 8, 2011 at 14:52, Ingo Molnar <mingo@elte.hu> wrote:
> >> So it would be nice to have more separation for remotes - right now
> >> they do not sit still in their sandboxes! :-)
> > 
> > Sounds like the "tags should go in their own namespaces in git 1.8.0"
> > [0] discussion? :)
> > 
> > [0]
> > http://thread.gmane.org/gmane.comp.version-control.git/165799/focus=16
> > 5837
> 
> A lengthy thread. Does anybody remember the outcome? Was Johan's
> proposal OK and only waiting to be implemented, or is there still
> unanswered questions?

(Sorry for the late answer. Unfortunately, I don't have much Git time these 
days...)

Browsing that thread, it seems my proposal was largely OK. AFAICS there are 
no major technical problems with moving to the following ref mapping:

  Remote repo    ->   Local repo
  --------------------------------------------------
  refs/heads/*        refs/remotes/$remote/heads/*
  refs/tags/*         refs/remotes/$remote/tags/*
  refs/replace/*      refs/remotes/$remote/replace/*
  refs/notes/*        refs/remotes/$remote/notes/*

There was a fair amount of discussion around whether we really _want_ to put 
all refs (especially tags) in separate per-remote namespaces, and it seems 
(both from that thread, and from later threads, like this one) that we _do_ 
want per-remote namespaces for all refs.

That said, there are a couple of outstanding questions/challenges before 
this can be implemented:


1. How to deal with tag auto-following

The tag auto-follow behavior currently depends on the implicit 
"refs/tags/*:refs/tags/*" refspec, and the "refs/tags/" prefix is presently 
hardcoded both at the local and remote end. If we want to support auto-
follow behavior in the new ref mappings (e.g. specified with a "~" prefix: 
"~+refs/tags/*:refs/remotes/$remote/tags/*"), we must change code both on 
the local and remote side. In order to get optimal behavior we will probably 
also need to make some protocol changes.

On the other hand, it is not clear how useful tag auto-following really is. 
Quoting Peff from the earlier thread ( 
http://thread.gmane.org/gmane.comp.version-control.git/160503/focus=160726 
): "Now you could argue that auto-follow is not worth the effort. It is 
somewhat confusing, and I can't think of a time when it ever actually 
reduced the set of objects I was fetching (as opposed to just fetching all 
tags). But maybe others have use cases where it matters."

Or, quoting Junio further down in the thread ( 
http://thread.gmane.org/gmane.comp.version-control.git/165799/focus=166694 
): "Also if you give tags a totally separate namespace, I don't see much 
reason to still give it the "auto-follow" semantics.  It is far simpler to 
explain if you just fetch all of them and be done with it, no?"

So far nobody have stood up to defend the current auto-following behavior as 
a necessary feature.


2. Interpreting/DWIMing refs

Changing the ref mappings require a revised set of rules for interpreting 
shorthand ref names (expanding them into full ref names), and handling 
ambiguities when they arise:

- "foo" should still be usable for "refs/heads/foo", "refs/tags/foo", etc.

- "origin/foo" must continue to work, even if "refs/remotes/origin/foo" has 
now become "refs/remotes/origin/heads/foo". In other words, "foo/bar" where 
"foo" is a valid remote, must try to resolve "bar" against the refspecs 
specified for the "foo" remote.

- For tag name "foo": "refs/tags/foo" (if exists) is unambiguous.

- If "refs/tags/foo" does not exist, tag name "foo" is unambiguous if it 
exists in one or more "refs/remotes/*/tags/foo" and they all point to the 
same SHA1.

- If "refs/tags/foo" does not exist, and more than one 
"refs/remotes/*/tags/foo" exist, and they do NOT all point to the same SHA1, 
then there is an ambiguity.

- The user may resolve the ambiguity by creating "refs/tags/foo" pointing to 
the chosen SHA1 ("refs/tags/foo" takes precedence over 
"refs/remotes/*/tags/foo").

- The same rules apply to heads, notes, etc.

- Extra care must be taken across different "types" of refs, depending on 
the context. I.e. in some situations we might want to prefer 
"refs/remotes/origin/heads/foo" to "refs/remotes/otherremote/tags/foo", or 
the other way around (or flag the ambiguity and abort).


3. Migration path

We need both styles of ref mappings ("traditional", with the implicit and 
auto-following tag refspec, and "new-style", where all refspecs are 
explicit) to work side-by-side in the same repo (i.e. having one remote use 
traditional refspecs, while another uses new-style). At first, we will 
probably still default to the traditional refspecs when creating a new 
remote, but over time we should migrate to new-style refspecs, before 
finally deprecating the traditional refspecs. I'm not sure if traditional 
vs. new-style can be reliably autodetected from the refspecs themselves, or 
if we need an explicit per-remote config variable to discern between the 
two.


I think all of the above problems are solvable.


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

  reply	other threads:[~2011-06-14  9:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08  9:36 Q: how can i find the upstream merge point of a commit? Ingo Molnar
2011-06-08 10:32 ` Johannes Sixt
2011-06-08 10:34 ` Stephen Rothwell
2011-06-08 10:40   ` Peter Zijlstra
2011-06-08 11:29     ` Stephen Rothwell
2011-06-08 11:51       ` Peter Zijlstra
2011-06-08 12:52   ` Ingo Molnar
2011-06-08 13:49     ` Sverre Rabbelier
2011-06-08 14:27       ` Ingo Molnar
2011-06-08 15:23       ` Nguyen Thai Ngoc Duy
2011-06-14  9:56         ` Johan Herland [this message]
2011-06-14 17:12           ` Jeff King
2011-06-14 23:45             ` Johan Herland
2011-06-15 23:00               ` Jeff King
2011-06-15 23:53                 ` Junio C Hamano
2011-06-16  0:48                   ` Jeff King
2011-06-16 11:33                     ` Jakub Narebski
2011-06-08 15:01     ` Junio C Hamano
2011-06-08 15:18       ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201106141156.56320.johan@herland.net \
    --to=johan@herland.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=git@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    --cc=sfr@canb.auug.org.au \
    --cc=srabbelier@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).