summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2008-02-20 18:43:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-25 04:05:29 (GMT)
commit55029ae4dac07942437c0c715ea7c8ac60dd3576 (patch)
treeb2e278bd16f852229e3a3149febb7df98171951b /t
parent2d31347ba5c56d43d64dfdfe04a924178ee55b75 (diff)
downloadgit-55029ae4dac07942437c0c715ea7c8ac60dd3576.zip
git-55029ae4dac07942437c0c715ea7c8ac60dd3576.tar.gz
git-55029ae4dac07942437c0c715ea7c8ac60dd3576.tar.bz2
Add support for url aliases in config files
This allows users with different preferences for access methods to the same remote repositories to rewrite each other's URLs by pattern matching across a large set of similiarly set up repositories to each get the desired access. For example, if you don't have a kernel.org account, you might want settings like: [url "git://git.kernel.org/pub/"] insteadOf = master.kernel.org:/pub Then, if you give git a URL like: master.kernel.org:/pub/scm/linux/kernel/git/linville/wireless-2.6.git it will act like you gave it: git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git and you can cut-and-paste pull requests in email without fixing them by hand, for example. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5516-fetch-push.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
index 9d2dc33..9023ba0 100755
--- a/t/t5516-fetch-push.sh
+++ b/t/t5516-fetch-push.sh
@@ -100,6 +100,23 @@ test_expect_success 'fetch with wildcard' '
)
'
+test_expect_success 'fetch with insteadOf' '
+ mk_empty &&
+ (
+ TRASH=$(pwd) &&
+ cd testrepo &&
+ git config url./$TRASH/.insteadOf trash/
+ git config remote.up.url trash/. &&
+ git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" &&
+ git fetch up &&
+
+ 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 without wildcard' '
mk_empty &&
@@ -126,6 +143,20 @@ test_expect_success 'push with wildcard' '
)
'
+test_expect_success 'push with insteadOf' '
+ mk_empty &&
+ TRASH=$(pwd) &&
+ git config url./$TRASH/.insteadOf trash/ &&
+ git push trash/testrepo 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)
+ )
+'
+
test_expect_success 'push with matching heads' '
mk_test heads/master &&