aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-11 22:33:51 -0700
committerJunio C Hamano <gitster@pobox.com>2008-03-11 22:33:51 -0700
commitae90e16a3a7586bc25b7c7de50e4c3ba4806b3b9 (patch)
treeb868ef92c090819f91ced2de2c179f40030934ae /t
parentb85997d14d1873a4baa3d04966cd5947e6134acd (diff)
parent3000658f7c15c880f976aac0ade73efd3b1e9790 (diff)
downloadgit-ae90e16a3a7586bc25b7c7de50e4c3ba4806b3b9.tar.gz
git-ae90e16a3a7586bc25b7c7de50e4c3ba4806b3b9.tar.xz
Merge branch 'js/remote'
* js/remote: "remote update": print remote name being fetched from builtin remote rm: remove symbolic refs, too remote: fix "update [group...]" remote show: Clean up connection correctly if object fetch wasn't done builtin-remote: prune remotes correctly that were added with --mirror Make git-remote a builtin Test "git remote show" and "git remote prune" parseopt: add flag to stop on first non option path-list: add functions to work with unsorted lists Conflicts: parse-options.c
Diffstat (limited to 't')
-rwxr-xr-xt/t5505-remote.sh143
1 files changed, 143 insertions, 0 deletions
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 4fc62f550..2822a651b 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -10,10 +10,12 @@ setup_repository () {
git init &&
>file &&
git add file &&
+ test_tick &&
git commit -m "Initial" &&
git checkout -b side &&
>elif &&
git add elif &&
+ test_tick &&
git commit -m "Second" &&
git checkout master
)
@@ -78,6 +80,7 @@ test_expect_success 'add another remote' '
test_expect_success 'remove remote' '
(
cd test &&
+ git symbolic-ref refs/remotes/second/HEAD refs/remotes/second/master &&
git remote rm second
)
'
@@ -94,4 +97,144 @@ test_expect_success 'remove remote' '
)
'
+cat > test/expect << EOF
+* remote origin
+ URL: $(pwd)/one/.git
+ Remote branch merged with 'git pull' while on branch master
+ master
+ New remote branch (next fetch will store in remotes/origin)
+ master
+ Tracked remote branches
+ side master
+EOF
+
+test_expect_success 'show' '
+ (cd test &&
+ git config --add remote.origin.fetch \
+ refs/heads/master:refs/heads/upstream &&
+ git fetch &&
+ git branch -d -r origin/master &&
+ (cd ../one &&
+ echo 1 > file &&
+ test_tick &&
+ git commit -m update file) &&
+ git remote show origin > output &&
+ git diff expect output)
+'
+
+test_expect_success 'prune' '
+ (cd one &&
+ git branch -m side side2) &&
+ (cd test &&
+ git fetch origin &&
+ git remote prune origin &&
+ git rev-parse refs/remotes/origin/side2 &&
+ ! git rev-parse refs/remotes/origin/side)
+'
+
+test_expect_success 'add --mirror && prune' '
+ (mkdir mirror &&
+ cd mirror &&
+ git init &&
+ git remote add --mirror -f origin ../one) &&
+ (cd one &&
+ git branch -m side2 side) &&
+ (cd mirror &&
+ git rev-parse --verify refs/heads/side2 &&
+ ! git rev-parse --verify refs/heads/side &&
+ git fetch origin &&
+ git remote prune origin &&
+ ! git rev-parse --verify refs/heads/side2 &&
+ git rev-parse --verify refs/heads/side)
+'
+
+cat > one/expect << EOF
+ apis/master
+ apis/side
+ drosophila/another
+ drosophila/master
+ drosophila/side
+EOF
+
+test_expect_success 'update' '
+
+ (cd one &&
+ git remote add drosophila ../two &&
+ git remote add apis ../mirror &&
+ git remote update &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
+cat > one/expect << EOF
+ drosophila/another
+ drosophila/master
+ drosophila/side
+ manduca/master
+ manduca/side
+ megaloprepus/master
+ megaloprepus/side
+EOF
+
+test_expect_success 'update with arguments' '
+
+ (cd one &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git remote add manduca ../mirror &&
+ git remote add megaloprepus ../mirror &&
+ git config remotes.phobaeticus "drosophila megaloprepus" &&
+ git config remotes.titanus manduca &&
+ git remote update phobaeticus titanus &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
+cat > one/expect << EOF
+ apis/master
+ apis/side
+ manduca/master
+ manduca/side
+ megaloprepus/master
+ megaloprepus/side
+EOF
+
+test_expect_success 'update default' '
+
+ (cd one &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git config remote.drosophila.skipDefaultUpdate true &&
+ git remote update default &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
+cat > one/expect << EOF
+ drosophila/another
+ drosophila/master
+ drosophila/side
+EOF
+
+test_expect_success 'update default (overridden, with funny whitespace)' '
+
+ (cd one &&
+ for b in $(git branch -r)
+ do
+ git branch -r -d $b || break
+ done &&
+ git config remotes.default "$(printf "\t drosophila \n")" &&
+ git remote update default &&
+ git branch -r > output &&
+ git diff expect output)
+
+'
+
test_done