aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@frugalware.org>2008-11-10 21:43:01 +0100
committerJunio C Hamano <gitster@pobox.com>2008-11-11 20:24:18 -0800
commit1dd1239aa33ddd7f159cd183338ef6f71298e29a (patch)
tree4c2013277d8c825c265c9c761adffaeee4700f37 /t
parent89cf4c7004ec329c3171448a154d050c8f75874e (diff)
downloadgit-1dd1239aa33ddd7f159cd183338ef6f71298e29a.tar.gz
git-1dd1239aa33ddd7f159cd183338ef6f71298e29a.tar.xz
git-remote rename: migrate from remotes/ and branches/
Remote definition that came from $GIT_DIR/remotes/nick and $GIT_DIR/branches/nick are migrated to [remotes "nick"] section in the configuration file. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t5505-remote.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 0c956bad6..1f59960d9 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -343,4 +343,37 @@ test_expect_success 'rename a remote' '
test "$(git config branch.master.remote)" = "upstream")
'
+
+cat > remotes_origin << EOF
+URL: $(pwd)/one
+Push: refs/heads/master:refs/heads/upstream
+Pull: refs/heads/master:refs/heads/origin
+EOF
+
+test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
+ git clone one five &&
+ origin_url=$(pwd)/one &&
+ (cd five &&
+ git remote rm origin &&
+ mkdir -p .git/remotes &&
+ cat ../remotes_origin > .git/remotes/origin &&
+ git remote rename origin origin &&
+ ! test -f .git/remotes/origin &&
+ test "$(git config remote.origin.url)" = "$origin_url" &&
+ test "$(git config remote.origin.push)" = "refs/heads/master:refs/heads/upstream" &&
+ test "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin")
+'
+
+test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
+ git clone one six &&
+ origin_url=$(pwd)/one &&
+ (cd six &&
+ git remote rm origin &&
+ echo "$origin_url" > .git/branches/origin &&
+ git remote rename origin origin &&
+ ! test -f .git/branches/origin &&
+ test "$(git config remote.origin.url)" = "$origin_url" &&
+ test "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin")
+'
+
test_done