xread/xwrite: clip MAX_IO_SIZE to SSIZE_MAX
[gitweb.git] / t / t5505-remote.sh
index 7ae238b5e26353a040a30e416752493d9c8ed583..8f6e3922dce2b676221610d83a87c5b36d3bc5b6 100755 (executable)
@@ -74,7 +74,7 @@ test_expect_success 'add another remote' '
        )
 '
 
-test_expect_success C_LOCALE_OUTPUT 'check remote tracking' '
+test_expect_success C_LOCALE_OUTPUT 'check remote-tracking' '
        (
                cd test &&
                check_remote_track origin master side &&
@@ -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' '
@@ -747,10 +749,20 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/remotes' '
                mkdir -p .git/remotes &&
                cat ../remotes_origin >.git/remotes/origin &&
                git remote rename origin origin &&
-               ! test -f .git/remotes/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
        )
 '
 
@@ -762,34 +774,48 @@ test_expect_success 'migrate a remote from named file in $GIT_DIR/branches' '
                git remote rm origin &&
                echo "$origin_url" >.git/branches/origin &&
                git remote rename origin origin &&
-               ! test -f .git/branches/origin &&
+               test_path_is_missing .git/branches/origin &&
                test "$(git config remote.origin.url)" = "$origin_url" &&
                test "$(git config remote.origin.fetch)" = "refs/heads/master:refs/heads/origin" &&
                test "$(git config remote.origin.push)" = "HEAD:refs/heads/master"
        )
 '
 
-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