Merge branch 'mr/autoconf-fread'
[gitweb.git] / t / t5505-remote.sh
index 0a25c8b71c63802602abab689a0bcbb6ff9c0f05..2822a651b5c434bb9243a6f8f9069a8fee1ad590 100755 (executable)
@@ -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
 )
 '
@@ -113,6 +116,7 @@ test_expect_success 'show' '
         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)
@@ -144,4 +148,93 @@ test_expect_success 'add --mirror && prune' '
         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