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

Re: [PATCH] push: Alias pushurl from push rewrites

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 28, 2013, 18:50 UTC
Message-ID
<7vr4iztl3z.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130328160937.GD16034@leaf>
Josh Triplett <josh@joshtriplett.org> writes:
(on url.$base.pushInsteadOf)
>> If a remote has an explicit pushurl, git will ignore this setting for
>> that remote.
> That really meant what I just said above: git will prefer an explicit
> pushurl over the pushInsteadOf rewrite of url.
Very correct.
> It says nothing about
> applying pushInsteadOf to rewrite pushurl.

Incorrect, I think. If you have pushURL, pushInsteadOf is *ignored*. Of course, if you have both URL and pushURL, the ignored pushInsteadOf will not apply to _anything_. It will not apply to URL, and it will certainly not apply to pushURL.

You are correct to point out that with the test we would want to make sure that for a remote with pushURL and URL, a push goes

 - to pushURL;
 - not to URL;
 - not to insteadOf(URL);
 - not to pushInsteadOf(URL);
 - not to insteadOf(pushURL); and
 - not to pushInsteadOf(pushURL).

I do not think it is worth checking all of them, but I agree we should make sure it does not go to pushInsteadOf(URL) which you originally meant to check, and we should also make sure it does not go to pushInsteadOf(pushURL).

Show 5 quoted lines
>>  test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' '
>>  	mk_empty &&
>> -	TRASH="$(pwd)/" &&
>> -	git config "url.trash2/.pushInsteadOf" trash/ &&
>> +	git config "url.trash2/.pushInsteadOf" testrepo/ &&
Adding
	git config "url.trash3/.pusnInsteadOf" trash/wrong &&

here should be sufficient for that, no? If we mistakenly used URL (i.e. trash/wrong) the push would fail. If we mistakenly used pushInsteadOf(URL), that is rewritten to trash3/ and again the push would fail. pushInsteadOf(pushURL) would go to trash2/ and that would also fail.

We aren't checking insteadOf(URL) and insteadOf(pushURL) but everything else is checked, I think, so we can do without replacing anything. We can just extend it, no?

Show 13 quoted lines
>>  	git config remote.r.url trash/wrong &&
>> -	git config remote.r.pushurl "$TRASH/testrepo" &&
>> +	git config remote.r.pushurl "testrepo/" &&
>>  	git push r refs/heads/master:refs/remotes/origin/master &&
>>  	(
>>  		cd testrepo &&
>
> ...the test you describe should appear in *addition* to this test, not
> replacing it, because as described above this test does test one
> critical bit of behavior, namely prefering pushurl over the
> pushInsteadOf rewrite of url.
>
> - Josh Triplett
Previous: Josh TriplettNext: Josh Triplett
Message 15 of 24 in “push: Alias pushurl from push rewrites”
  1. push: Alias pushurl from push rewritesRob Hoelz, Mar 27, 2013
  2. Jonathan NiederMar 27, 2013
  3. Jonathan NiederMar 27, 2013
  4. Junio C HamanoMar 27, 2013
  5. Rob HoelzMar 27, 2013
  6. Josh TriplettMar 27, 2013
  7. Josh TriplettMar 27, 2013
  8. Jonathan NiederMar 27, 2013
  9. Junio C HamanoMar 28, 2013
  10. Josh TriplettMar 28, 2013
  11. Junio C HamanoMar 28, 2013
  12. Josh TriplettMar 28, 2013
  13. Junio C HamanoMar 28, 2013
  14. Josh TriplettMar 28, 2013
  15. Junio C HamanoMar 28, 2013
  16. Josh TriplettMar 28, 2013
  17. Jonathan NiederMar 28, 2013
  18. Rob HoelzMar 29, 2013
  19. Junio C HamanoMar 29, 2013
  20. Rob HoelzMar 27, 2013
  21. Jonathan NiederMar 27, 2013
  22. Rob HoelzMar 27, 2013
  23. Jonathan NiederMar 27, 2013
  24. Rob HoelzMar 27, 2013

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.