git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* URL substitution and config file precedence
@ 2010-08-02 15:37 martin f krafft
  2010-08-02 16:05 ` Ævar Arnfjörð Bjarmason
  2010-08-02 20:57 ` Jonathan Nieder
  0 siblings, 2 replies; 5+ messages in thread
From: martin f krafft @ 2010-08-02 15:37 UTC (permalink / raw)
  To: git discussion list

[-- Attachment #1: Type: text/plain, Size: 2013 bytes --]

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://).

  2. URL substitution is not recursive, or else the git:// URL would
     eventually be replaced with the ssh:// URL.

I can address both issues by adding a "pushInsteadOf = madduck:" to
~/.gitconfig, but …

… that only addresses pushing. I don't see a way to fix fetching,
where the pushInsteadOf trick does not work.

Any ideas how to work around it?

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/|

Thoughts?

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
"stab it and steer"
                                                             -- sailor
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-02 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).