git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: URL substitution and config file precedence

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Aug 2, 2010, 16:05 UTC
Message-ID
<AANLkTikdyNjcgZpY=BPjkieacDXHPvp0he77VJZCMLpw@mail.gmail.com>
In-Reply-To
<20100802153720.GA28481@fishbowl.rw.madduck.net>
On Mon, Aug 2, 2010 at 15:37, martin f krafft <madduck@madduck.net> wrote:
Show 31 quoted lines
> 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.
Show 9 quoted lines
> 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.

Previous: martin f krafftNext: martin f krafft
Message 2 of 5 in “URL substitution and config file precedence”
  1. martin f krafftAug 2, 2010
  2. Ævar Arnfjörð BjarmasonAug 2, 2010
  3. martin f krafftAug 2, 2010
  4. Ævar Arnfjörð BjarmasonAug 2, 2010
  5. Jonathan NiederAug 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.