Subject: Re: [PATCH] t5516-fetch-push: Correct misspelled pushInsteadOf

From: Junio C Hamano <[email-masked]>
Date: Wed, 04 Mar 2015 12:14:26 -0800

Michael J Gruber <[email-masked]> writes:

>> I am not sure how the intention of the commit 1c2eafb8 (Add
>> url.<base>.pushInsteadOf: URL rewriting for push only, 2009-09-07),
>> which introduced the behaviour verified by this test, interacts with
>> the desire to redefine what URL and pushURL mean in our recent past,
>> what e.g. e6196ae1 (remote: add --fetch and --both options to set-url,
>> 2014-11-25) wanted to do, though.  Thoughts?
>> 
>
> Wow. That looks strange to me on first read. Sorry I didn't catch it
> back then. "--fetch" sets both url and pushurl??

Yeah, sounds crazy, no?  Taken in isolation without consideration
around the InsteadOf rewriting, the change sort-of makes sense,
though.

But I do not know if the combined whole makes much sense.

> So, for definiteness sake, I'll use "url" and "pushurl" for the config
> names and struct members (which the config values end up in), and I'll
> use "URL for fetch" and "URL for push" for the URLs that git will use
> for fetch resp. push.
>
> If there is no "pushurl":
>   "url" will be used as the "URL for fetch" and as the "URL for push".
>   if we are pushing and there is "pushinsteadof" for (part of) "url"
>     subsitute that within "url"
>   else if there is "insteadof" for (part of) "url"
>     substitute that within "url"
>
> If there is a "pushurl":
>   "url" will be used as the "URL for fetch" and "pushurl" as the "URL
> for push".
>   if we are pushing and there is "insteadof" for (part of) "pushurl"
>     substitute that within "pushurl"
>   else if we are fetching and there is "insteadof" for (part of) "url"
>     substiute that within "url"

These make sense to me.

> I don't know what "remote set-url" does, I think the whole remote
> command as it is does not fit in well with our UI, but that applies to
> other commands with non-option subcommands as well (or bad). I would
> have hoped it is set-url and set-pushurl to set those two config
> options.

I would have hoped so, too, but I don't use "git remote" myself (as
you said, it is an odd man out and there is nothing it and only it
can do that is essential for my everyday workflow), so... ;-)

> I rarely use pushurl, but could use it to override url, or to do the
> above magic on a case by case level, such as if I need to specify
> different usernames for the same host.
>
> So, that's my understanding of how these things are supposed to work and
> why it is useful.

Yes, I am not questioning the usefulness of insteadof magic.  I am
wondering if that "--fetch sets both?" breaks the expectation of
those who rely on it.