All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Rob Hoelz <rob@hoelz.ro>
Cc: git@vger.kernel.org, josh@joshtriplett.org
Subject: Re: [PATCH] push: Alias pushurl from push rewrites
Date: Sun, 17 Mar 2013 16:35:59 -0700	[thread overview]
Message-ID: <7vd2uxppk0.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20130317235040.4cdc9ef2@hoelz.ro> (Rob Hoelz's message of "Sun, 17 Mar 2013 23:50:40 +0100")

Rob Hoelz <rob@hoelz.ro> writes:

> git push currently doesn't consider pushInsteadOf when
> using pushurl; this tests and fixes that.
>
> If you use pushurl with an alias that has a pushInsteadOf configuration
> value, Git does not take advantage of it.  For example:
>
> [url "git://github.com/"]
>     insteadOf = github:
> [url "git://github.com/myuser/"]
>     insteadOf = mygithub:
> [url "git@github.com:myuser/"]
>     pushInsteadOf = mygithub:
> [remote "origin"]
>     url     = github:organization/project
>     pushurl = mygithub:project

Incomplete sentence?  For example [this is an example configuration]
and then what happens?  Something like "with the sample
configuration, 'git push origin' should follow pushurl and then turn
it into X, but instead it ends up accessing Y".

If there is no pushInsteadOf, does it still follow insteadOf?  Is it
tested already?

Wouldn't you want to cover all the combinations to negative cases
(i.e. making sure the codepath to support a new case does not affect
behaviour of the code outside the new case)?  A remote with and
without pushurl (two combinations) and a pseudo URL scheme with and
without pushInsteadOf (again, two combinations) will give you four
cases.


Thanks.

>
> Signed-off-by: Rob Hoelz <rob@hoelz.ro>
> ---
>  remote.c              |  2 +-
>  t/t5516-fetch-push.sh | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/remote.c b/remote.c
> index ca1f8f2..de7a915 100644
> --- a/remote.c
> +++ b/remote.c
> @@ -465,7 +465,7 @@ static void alias_all_urls(void)
>  		if (!remotes[i])
>  			continue;
>  		for (j = 0; j < remotes[i]->pushurl_nr; j++) {
> -			remotes[i]->pushurl[j] = alias_url(remotes[i]->pushurl[j], &rewrites);
> +			remotes[i]->pushurl[j] = alias_url(remotes[i]->pushurl[j], &rewrites_push);
>  		}
>  		add_pushurl_aliases = remotes[i]->pushurl_nr == 0;
>  		for (j = 0; j < remotes[i]->url_nr; j++) {
> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
> index b5417cc..272e225 100755
> --- a/t/t5516-fetch-push.sh
> +++ b/t/t5516-fetch-push.sh
> @@ -244,6 +244,26 @@ test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf
>  	)
>  '
>  
> +test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf does rewrite in this case)' '
> +	mk_empty &&
> +	TRASH="$(pwd)/" &&
> +	mkdir ro &&
> +	mkdir rw &&
> +	git init --bare rw/testrepo &&
> +	git config "url.file://$TRASH/ro/.insteadOf" ro: &&
> +	git config "url.file://$TRASH/rw/.pushInsteadOf" rw: &&
> +	git config remote.r.url ro:wrong &&
> +	git config remote.r.pushurl rw:testrepo &&
> +	git push r refs/heads/master:refs/remotes/origin/master &&
> +	(
> +		cd rw/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)
> +	)
> +'
> +
>  test_expect_success 'push with matching heads' '
>  
>  	mk_test heads/master &&

  reply	other threads:[~2013-03-17 23:36 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-17 22:50 [PATCH] push: Alias pushurl from push rewrites Rob Hoelz
2013-03-17 23:35 ` Junio C Hamano [this message]
2013-03-18 10:01   ` Rob Hoelz
2013-03-18 20:59   ` Rob Hoelz
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-27 17:22 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
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
2013-03-27 22:42 Rob Hoelz
2013-03-27 23:08 ` Junio C Hamano
2013-03-28  0:07 ` Jonathan Nieder

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=7vd2uxppk0.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=josh@joshtriplett.org \
    --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.