Merge branch 'nd/connect-ssh-command-config'
[gitweb.git] / t / t5505-remote.sh
index 013e03dee2651f6891782325671f0764bb02f41f..8198d8eb05c5366c7d61a12351c333902a2265b6 100755 (executable)
@@ -51,6 +51,11 @@ test_expect_success setup '
        git clone one test
 '
 
+test_expect_success 'add remote whose URL agrees with url.<...>.insteadOf' '
+       test_config url.git@host.com:team/repo.git.insteadOf myremote &&
+       git remote add myremote git@host.com:team/repo.git
+'
+
 test_expect_success C_LOCALE_OUTPUT 'remote information for the origin' '
        (
                cd test &&
@@ -85,7 +90,7 @@ test_expect_success C_LOCALE_OUTPUT 'check remote-tracking' '
 test_expect_success 'remote forces tracking branches' '
        (
                cd test &&
-               case `git config remote.second.fetch` in
+               case $(git config remote.second.fetch) in
                +*) true ;;
                 *) false ;;
                esac
@@ -139,6 +144,39 @@ test_expect_success 'remove remote protects local branches' '
        )
 '
 
+test_expect_success 'remove errors out early when deleting non-existent branch' '
+       (
+               cd test &&
+               echo "fatal: No such remote: foo" >expect &&
+               test_must_fail git remote rm foo 2>actual &&
+               test_i18ncmp expect actual
+       )
+'
+
+test_expect_success 'rename errors out early when deleting non-existent branch' '
+       (
+               cd test &&
+               echo "fatal: No such remote: foo" >expect &&
+               test_must_fail git remote rename foo bar 2>actual &&
+               test_i18ncmp expect actual
+       )
+'
+
+test_expect_success 'add existing foreign_vcs remote' '
+       test_config remote.foo.vcs bar &&
+       echo "fatal: remote foo already exists." >expect &&
+       test_must_fail git remote add foo bar 2>actual &&
+       test_i18ncmp expect actual
+'
+
+test_expect_success 'add existing foreign_vcs remote' '
+       test_config remote.foo.vcs bar &&
+       test_config remote.bar.vcs bar &&
+       echo "fatal: remote bar already exists." >expect &&
+       test_must_fail git remote rename foo bar 2>actual &&
+       test_i18ncmp expect actual
+'
+
 cat >test/expect <<EOF
 * remote origin
   Fetch URL: $(pwd)/one
@@ -1144,7 +1182,7 @@ test_expect_success 'extra args: setup' '
 test_extra_arg () {
        test_expect_success "extra args: $*" "
                test_must_fail git remote $* bogus_extra_arg 2>actual &&
-               grep '^usage:' actual
+               test_i18ngrep '^usage:' actual
        "
 }