提交 7fd92d9e 编写于 作者: J Junio C Hamano

Merge branch 'js/remote-add-with-insteadof'

"git remote add $name $URL" is now allowed when "url.$URL.insteadOf"
is already defined.

* js/remote-add-with-insteadof:
  Add a regression test for 'git remote add <existing> <same-url>'
  git remote: allow adding remotes agreeing with url.<...>.insteadOf
......@@ -180,7 +180,9 @@ static int add(int argc, const char **argv)
url = argv[1];
remote = remote_get(name);
if (remote && (remote->url_nr > 1 || strcmp(name, remote->url[0]) ||
if (remote && (remote->url_nr > 1 ||
(strcmp(name, remote->url[0]) &&
strcmp(url, remote->url[0])) ||
remote->fetch_refspec_nr))
die(_("remote %s already exists."), name);
......
......@@ -1113,4 +1113,9 @@ test_extra_arg set-url origin newurl oldurl
# prune takes any number of args
# update takes any number of args
test_expect_success 'add remote matching the "insteadOf" URL' '
git config url.xyz@example.com.insteadOf backup &&
git remote add backup xyz@example.com
'
test_done
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册