All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: Rob Hoelz <rob@hoelz.ro>, Jonathan Nieder <jrnieder@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] push: Alias pushurl from push rewrites
Date: Thu, 28 Mar 2013 08:37:58 -0700	[thread overview]
Message-ID: <7vfvzfwn55.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20130327230943.GA5204@jtriplet-mobl1> (Josh Triplett's message of "Wed, 27 Mar 2013 16:09:43 -0700")

Josh Triplett <josh@joshtriplett.org> writes:

> On Wed, Mar 27, 2013 at 05:48:45PM -0500, Rob Hoelz wrote:
> ...
>> The test that checked that pushInsteadOf + pushurl shouldn't work as I
>> expect was actually broken; I have removed it, updated the
>> documentation, and sent a new patch to the list.
>
> There's an argument for either behavior as valid.  My original patch
> specifically documented and tested for the opposite behavior, namely
> that pushurl overrides any pushInsteadOf, because I intended
> pushInsteadOf as a fallback if you don't have an explicit pushurl set.

For only this bit.

I think the test in question is this one from t5516:

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 remote.r.url trash/wrong &&
	git config remote.r.pushurl "$TRASH/testrepo" &&
	git push r refs/heads/master:refs/remotes/origin/master &&
	(
		cd testrepo &&
		r=$(git show-ref -s --verify refs/remotes/origin/master) &&
		test "z$r" = "z$the_commit" &&

		test 1 = $(git for-each-ref refs/remotes/origin | wc -l)
	)
'

It defines a remote "r", with URL "trash/wrong" (used for fetch) and
pushURL "$(pwd)/testrepo" (used for push).  There is a pushInsteadOf
rule to rewrite anything that goes to "trash/*" to be pushed to
"trash2/*" instead but that shouldn't be used to rewrite an explicit
pushURL.

And then the test pushes to "r" and checks if testrepo gets updated;
in other words, it wants to make sure remote.r.pushURL defines the
final destination, without pushInsteadOf getting in the way.

But $(pwd)/testrepo does not match trash/* in the first place, so
there is no chance for a pushInsteadOf to interfere; it looks to me
that it is not testing what it wants to test.

Perhaps we should do something like this?  We tell it to push to
"testrepo/" with pushURL, and set up a pushInsteadOf to rewrite
"testrepo/" to "trash2/", but because for this push it comes from an
explicit pushURL, it still goes to "testrepo/".

As we do not have "trash2/" repository, the test not just tests the
push goes to "testrepo/", but it also tests that it does not attempt
to push to "trash2/", checking both sides of the coin.

 t/t5516-fetch-push.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index d3dc5df..b5ea32c 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -230,10 +230,9 @@ test_expect_success 'push with pushInsteadOf' '
 
 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/ &&
 	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 &&

  parent reply	other threads:[~2013-03-28 15:38 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-27 17:22 [PATCH] push: Alias pushurl from push rewrites Rob Hoelz
2013-03-27 18:23 ` Jonathan Nieder
2013-03-27 21:15   ` Jonathan Nieder
2013-03-27 22:07     ` Junio C Hamano
2013-03-27 22:48       ` Rob Hoelz
2013-03-27 23:09         ` Josh Triplett
2013-03-27 23:17           ` Josh Triplett
2013-03-27 23:18           ` Jonathan Nieder
2013-03-28 15:52             ` Junio C Hamano
2013-03-28 16:01             ` Josh Triplett
2013-03-28 16:10               ` Junio C Hamano
2013-03-28 16:40                 ` Josh Triplett
2013-03-28 15:37           ` Junio C Hamano [this message]
2013-03-28 16:09             ` Josh Triplett
2013-03-28 18:50               ` Junio C Hamano
2013-03-28 19:03                 ` Josh Triplett
2013-03-28 19:25                   ` Jonathan Nieder
2013-03-29  4:53                     ` Rob Hoelz
2013-03-29  5:29                       ` Junio C Hamano
2013-03-27 22:29   ` Rob Hoelz
2013-03-27 22:47     ` Jonathan Nieder
2013-03-27 22:53       ` Rob Hoelz
2013-03-27 22:56         ` Jonathan Nieder
2013-03-27 23:06           ` Rob Hoelz
  -- strict thread matches above, loose matches on Subject: below --
2013-03-27 22:42 Rob Hoelz
2013-03-27 23:08 ` Junio C Hamano
2013-03-28  0:07 ` Jonathan Nieder
2013-03-18 21:02 Rob Hoelz
2013-03-18 23:10 ` Jonathan Nieder
2013-03-19  1:46   ` Junio C Hamano
2013-03-19  1:55     ` Jonathan Nieder
2013-03-19 18:08       ` Junio C Hamano
2013-03-20 12:33         ` Rob Hoelz
2013-03-20 14:35           ` Junio C Hamano
2013-03-27 17:20             ` Rob Hoelz
2013-03-17 22:50 Rob Hoelz
2013-03-17 23:35 ` Junio C Hamano
2013-03-18 10:01   ` Rob Hoelz
2013-03-18 20:59   ` Rob Hoelz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vfvzfwn55.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=josh@joshtriplett.org \
    --cc=jrnieder@gmail.com \
    --cc=rob@hoelz.ro \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.