From: Rob Hoelz <rob@hoelz.ro>
To: git@vger.kernel.org
Cc: josh@joshtriplett.org
Subject: [PATCH] remote.<name>.pushurl does not consider aliases when pushing
Date: Sun, 17 Mar 2013 22:40:02 +0100 [thread overview]
Message-ID: <20130317224002.366f54f7@hoelz.ro> (raw)
Hi everyone! I found a bug in Git today and wrote up a fix; I did my best to conform to the rules layed out in Documentation/SubmittingPatches, but please let me know if I need to change anything to get my work merged. =) I have CC'ed Josh Triplet, as
he was the last one to touch the line I modified. I hope my commit messages explain the problem I encountered well enough; if not,
I can always go back and amend them.
Patches follow.
-Rob
>From 5007b11e86c0835807632cb41e6cfa75ce9a1aa1 Mon Sep 17 00:00:00 2001
From: Rob Hoelz <rob@hoelz.ro>
Date: Sun, 17 Mar 2013 21:49:20 +0100
Subject: [PATCH 1/2] Add test for pushInsteadOf + pushurl
git push currently doesn't consider pushInsteadOf when
using pushurl; this test tests that.
Signed-off-by: Rob Hoelz <rob@hoelz.ro>
---
t/t5500-push-pushurl.sh | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 t/t5500-push-pushurl.sh
diff --git a/t/t5500-push-pushurl.sh b/t/t5500-push-pushurl.sh
new file mode 100644
index 0000000..74d4ff6
--- /dev/null
+++ b/t/t5500-push-pushurl.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Copyright (c) 2013 Rob Hoelz
+#
+
+test_description='Test that remote.<name>.pushurl uses pushInsteadOf'
+. ./test-lib.sh
+
+wd=$(pwd)
+test_expect_success 'setup test repositories' '
+ mkdir ro &&
+ mkdir rw &&
+
+ git init --bare ro/repo &&
+ git init --bare rw/repo &&
+ git init test-repo
+'
+
+test_expect_success 'setup remote config' "
+ cd test-repo &&
+ git config 'url.file://$wd/ro/.insteadOf' herero: &&
+ git config 'url.file://$wd/rw/.pushInsteadOf' hererw: &&
+ git remote add origin herero:repo &&
+ git config remote.origin.pushurl hererw:repo
+"
+
+test_expect_success 'test commit and push' '
+ test_commit one &&
+ git push origin master:master
+'
+
+test_expect_success 'check for commits in rw repo' '
+ cd ../rw/repo &&
+ git log --pretty=oneline | grep -q .
+'
+
+test_done
--
1.8.2
>From 0cbd1aab6bdc0c2f8893ed8b9a8e3eb0126917d1 Mon Sep 17 00:00:00 2001
From: Rob Hoelz <rob@hoelz.ro>
Date: Sun, 17 Mar 2013 16:34:35 +0100
Subject: [PATCH 2/2] push: Alias pushurl from push rewrites
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
This commit fixes that.
Signed-off-by: Rob Hoelz <rob@hoelz.ro>
---
remote.c | 2 +-
1 file changed, 1 insertion(+), 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++) {
--
1.8.2
next reply other threads:[~2013-03-17 21:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-17 21:40 Rob Hoelz [this message]
2013-03-17 22:14 ` [PATCH] remote.<name>.pushurl does not consider aliases when pushing Junio C Hamano
2013-03-17 22:47 ` 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=20130317224002.366f54f7@hoelz.ro \
--to=rob@hoelz.ro \
--cc=git@vger.kernel.org \
--cc=josh@joshtriplett.org \
/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).