git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: martin f krafft <madduck@madduck.net>
Cc: git discussion list <git@vger.kernel.org>
Subject: Re: URL substitution and config file precedence
Date: Mon, 2 Aug 2010 16:05:34 +0000	[thread overview]
Message-ID: <AANLkTikdyNjcgZpY=BPjkieacDXHPvp0he77VJZCMLpw@mail.gmail.com> (raw)
In-Reply-To: <20100802153720.GA28481@fishbowl.rw.madduck.net>

On Mon, Aug 2, 2010 at 15:37, martin f krafft <madduck@madduck.net> wrote:
> Dear Gits,
>
> I expect .git/config to tae precedence over ~/.gitconfig, which in
> turn gets favoured over /etc/gitconfig. This works fine, except for
> the url.….insteadOf settings.
>
> Have a look at the following:
>
>  % 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://).

Right, the git-config backend just merges on a key-value basis. It isn't smart.

> Why was the syntax chosen backwards in this way? Why not have
>
>  [urlsubst "madduck:"]
>      replaceWith = ssh://git.madduck.net/madduck/
>
> or even better:
>
>  [url_regsubst]
>      somefreelychosenname = s|madduck:|ssh://git.madduck.net/madduck/|

I don't know, but it usually helps if you add the person who added the
feature to the CC-list.

  reply	other threads:[~2010-08-02 16:05 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 [this message]
2010-08-02 17:38   ` martin f krafft
2010-08-02 17:46     ` Ævar Arnfjörð Bjarmason
2010-08-02 20:57 ` Jonathan Nieder

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='AANLkTikdyNjcgZpY=BPjkieacDXHPvp0he77VJZCMLpw@mail.gmail.com' \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --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).