t/t5505-remote: test multiple push/pull in remotes-file
[gitweb.git] / t / t5505-remote.sh
index 396a8133a780ffa3538008bb72a5c29c25495cc2..ee5d65d52f6d1d4dba6b1664f4dae23ebe69429d 100755 (executable)
@@ -735,7 +735,9 @@ test_expect_success 'rename a remote with name prefix of other remote' '
 cat >remotes_origin <<EOF
 URL: $(pwd)/one
 Push: refs/heads/master:refs/heads/upstream
+Push: refs/heads/next:refs/heads/upstream2
 Pull: refs/heads/master:refs/heads/origin
+Pull: refs/heads/next:refs/heads/origin2
 EOF
 
 test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
@@ -749,8 +751,18 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
                git remote rename origin origin &&
                test_path_is_missing .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"
+               cat >push_expected <<-\EOF &&
+               refs/heads/master:refs/heads/upstream
+               refs/heads/next:refs/heads/upstream2
+               EOF
+               cat >fetch_expected <<-\EOF &&
+               refs/heads/master:refs/heads/origin
+               refs/heads/next:refs/heads/origin2
+               EOF
+               git config --get-all remote.origin.push >push_actual &&
+               git config --get-all remote.origin.fetch >fetch_actual &&
+               test_cmp push_expected push_actual &&
+               test_cmp fetch_expected fetch_actual
        )
 '
 
@@ -769,27 +781,41 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
        )
 '
 
-test_expect_success 'remote prune to cause a dangling symref' '
+test_expect_success 'migrate a remote from named file in $GIT_DIR/branches (2)' '
        git clone one seven &&
+       (
+               cd seven &&
+               git remote rm origin &&
+               echo "quux#foom" > .git/branches/origin &&
+               git remote rename origin origin &&
+               test_path_is_missing .git/branches/origin &&
+               test "$(git config remote.origin.url)" = "quux" &&
+               test "$(git config remote.origin.fetch)" = "refs/heads/foom:refs/heads/origin"
+               test "$(git config remote.origin.push)" = "HEAD:refs/heads/foom"
+       )
+'
+
+test_expect_success 'remote prune to cause a dangling symref' '
+       git clone one eight &&
        (
                cd one &&
                git checkout side2 &&
                git branch -D master
        ) &&
        (
-               cd seven &&
+               cd eight &&
                git remote prune origin
        ) >err 2>&1 &&
        test_i18ngrep "has become dangling" err &&
 
        : And the dangling symref will not cause other annoying errors &&
        (
-               cd seven &&
+               cd eight &&
                git branch -a
        ) 2>err &&
        ! grep "points nowhere" err &&
        (
-               cd seven &&
+               cd eight &&
                test_must_fail git branch nomore origin
        ) 2>err &&
        grep "dangling symref" err