Merge branch 'tg/git-remote'

The internal API to interact with "remote.*" configuration
variables has been streamlined.

* tg/git-remote:
  remote: use remote_is_configured() for add and rename
  remote: actually check if remote exits
  remote: simplify remote_is_configured()
  remote: use parse_config_key
This commit is contained in:
Junio C Hamano
2016-02-26 13:37:09 -08:00
5 changed files with 81 additions and 65 deletions

View File

@@ -144,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