mirror of
https://github.com/git/git.git
synced 2024-11-28 12:34:08 +08:00
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
This commit is contained in:
commit
7fd92d9ed0
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user