Re: URL substitution and config file precedence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]