Subject: Re: git pull

From: Junio C Hamano <[email-masked]>
Date: Mon, 20 Nov 2017 14:37:45 +0900

Linus Torvalds <[email-masked]> writes:

> A few notes for other people who end up doing this:

[this meaning use of insteadOf to redirect public URLs to
ssh://git@gitolite URL]

>  (a) ssh is slower, and the gitolite machine is not as reachable.
>
>  (b) it affects your merge commit message.
>
> As to (a), yes it's noticeable, but the extra couple of seconds isn't
> really that big of a deal. Depending on exactly where you are, though,
> you might end up wanting to use https:// to the public servers
> instead.
>
> But (b) actually ends up being annoying, because I don't like my merge
> commits to contain references to repositories that aren't actually
> available unless you have a kernel.org account.
> ...
> Which is simple. Just create a .git/hooks/prepare-commit-msg file that contains
>
>   #!/bin/sh
>   sed -i 's|ssh://gitolite.kernel.org/|git://git.kernel.org/|g' "$1"
>
> and make it executable, and git will do that commit message editing for you.

This should work with any recent versions of Git (1.7.4.2 and
upwards), but it still is a workaround.  Should we mark it as a
feature request in the Git land to record the URL you typed as-is in
the builtin/fetch.c::store_updated_refs() function, instead of the
one that was rewritten by the insteadOf mechanism?

It would probably need an update to "struct remote" to have new
fields, to teach remote.c::alias_all_urls() not to overwrite the
url[] (and pushurl[] merely for symmetry) fields, to add a field to
"struct transport" and teach transport.c::transport_get() to record
the original URL in it so that builtin/fetch.c::fetch_refs() can
give it to store_updated_refs() instead of the rewritten one.

Many tiny changes in a rather deep codepath, but feels fairly a safe
change that is isolated and straightforward.