From: Jonathan Nieder <jrnieder@gmail.com>
To: Rob Hoelz <rob@hoelz.ro>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
josh@joshtriplett.org
Subject: Re: [PATCH] push: Alias pushurl from push rewrites
Date: Mon, 18 Mar 2013 16:10:43 -0700 [thread overview]
Message-ID: <20130318231043.GD5062@elie.Belkin> (raw)
In-Reply-To: <20130318220224.3b23a381@hoelz.ro>
Hi,
Rob Hoelz wrote:
> [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
>
> With the above configuration, the following occurs:
>
> $ git push origin master
> fatal: remote error:
> You can't push to git://github.com/myuser/project.git
> Use git@github.com:myuser/project.git
>
> So you can see that pushurl is being followed (it's not attempting to
> push to git://github.com/organization/project), but insteadOf values are
> being used as opposed to pushInsteadOf values for expanding the pushurl
> alias.
At first glance it is not always obvious how overlapping settings like
these should interact. Thanks for an instructive example that makes
the right behavior obvious.
Test nits:
[...]
> --- a/t/t5516-fetch-push.sh
> +++ b/t/t5516-fetch-push.sh
> @@ -244,6 +244,87 @@ test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf
> )
> '
>
> +test_expect_success 'push with pushInsteadOf and explicit pushurl (pushurl + pushInsteadOf does rewrite in this case)' '
> + mk_empty &&
> + rm -rf ro rw &&
> + 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: &&
The surrounding tests don't do this, but I wonder if it would make
sense to use test_config instead of 'git config' here.
That way, the test's settings wouldn't affect other tests, and in
particular if someone later decides to refactor the file by reordering
tests, she could be confident that that would not break anything.
In most of the surrounding tests it does not matter because 'git
config' is run in a subdirectory that is not reused later. Patches
fixing the exceptions below.
> + 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)
> + )
To produce more useful "./t5516-fetch-push.sh -v -i" output when the
comparison fails:
echo "$the_commit commit refs/remotes/origin/master" >expect &&
(
cd rw/testrepo &&
git for-each-ref refs/remotes/origin
) >actual &&
test_cmp expect actual
Hope that helps,
Jonathan Nieder (3):
push test: use test_config where appropriate
push test: simplify check of push result
push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi'
t/t5516-fetch-push.sh | 156 +++++++++++++++++++++-----------------------------
1 file changed, 65 insertions(+), 91 deletions(-)
next prev parent reply other threads:[~2013-03-18 23:17 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-18 21:02 [PATCH] push: Alias pushurl from push rewrites Rob Hoelz
2013-03-18 23:10 ` Jonathan Nieder [this message]
2013-03-18 23:12 ` [PATCH 1/3] push test: use test_config when appropriate Jonathan Nieder
2013-03-18 23:13 ` [PATCH 2/3] push test: simplify check of push result Jonathan Nieder
2013-03-18 23:14 ` [PATCH 3/3] push test: rely on &&-chaining instead of 'if bad; then echo Oops; fi' Jonathan Nieder
2013-03-19 1:46 ` [PATCH] push: Alias pushurl from push rewrites 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
-- 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-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-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=20130318231043.GD5062@elie.Belkin \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).