git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: martin f krafft <madduck@madduck.net>
Cc: "git discussion list" <git@vger.kernel.org>,
	"Daniel Barkalow" <barkalow@iabervon.org>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: URL substitution and config file precedence
Date: Mon, 2 Aug 2010 15:57:48 -0500	[thread overview]
Message-ID: <20100802205748.GA2890@burratino> (raw)
In-Reply-To: <20100802153720.GA28481@fishbowl.rw.madduck.net>

martin f krafft wrote:

>   % grep madduck: .git/config
>     url = madduck:pub/puppet/modules/git
> 
>   % grep -B1 nsteadOf /etc/gitconfig ~/.gitconfig
>   /etc/gitconfig-[url "git://git.madduck.net/madduck/"]
>   /etc/gitconfig: insteadOf = madduck:
>   --
>   /home/madduck/.gitconfig-[url "ssh://git.madduck.net/madduck/"]
>   /home/madduck/.gitconfig:       insteadOf = madduck:
>   /home/madduck/.gitconfig:       pushInsteadOf = git://git.madduck.net/madduck/
> 
>   % git push -v
>   Pushing to git://git.madduck.net/madduck/pub/puppet/modules/git
>   fatal: The remote end hung up unexpectedly
> 
> There seem to be two problems:
> 
>   1. the value from /etc/gitconfig seems to be preferred over the
>      one from ~/.gitconfig. I think this is due to the fact that the
>      syntax for URL substitution is a bit whack and the two keys
>      different, so the merge is actually a union-merge, and then the
>      result is probably just the first match (git:// sorts before
>      ssh://).

Almost.  I do not think there is any sorting involved.

It instead seems to be an unintended consequence of the "first match
wins" rule from v1.5.5-rc0~142^2 (url rewriting: take longest and
first match, 2008-02-24).  If we were starting over, I think it would
make more sense to make the _last_ match win, which would be closer to
how git configuration works in general.

> Why was the syntax chosen backwards in this way? Why not have
> 
>   [urlsubst "madduck:"]
>       replaceWith = ssh://git.madduck.net/madduck/

I wasn’t there, so I can’t complain.
http://thread.gmane.org/gmane.comp.version-control.git/74535/focus=74594

I think you’re right, that

	[fakeurl "madduck:"]
		url = git://git.madduck.net/madduck/
		pushurl = ssh://git.madduck.net/madduck/

or similar would be more convenient to work with than

	[url "ssh://git.madduck.net/madduck/"]
		pushinsteadof = madduck:
	[url "git://git.madduck.net/madduck/"]
		insteadof = madduck:

Jonathan

      parent reply	other threads:[~2010-08-02 20:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-02 15:37 URL substitution and config file precedence martin f krafft
2010-08-02 16:05 ` Ævar Arnfjörð Bjarmason
2010-08-02 17:38   ` martin f krafft
2010-08-02 17:46     ` Ævar Arnfjörð Bjarmason
2010-08-02 20:57 ` Jonathan Nieder [this message]

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=20100802205748.GA2890@burratino \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madduck@madduck.net \
    /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).