Commit 9d1751bf6e903821e87f331b8f63a2d5616a9d6c

Vicent Martí 2013-08-14T06:44:28

Merge pull request #1783 from libgit2/cmn/relax-remote remote: relax the url rules

diff --git a/src/remote.c b/src/remote.c
index 158f3e9..0dda196 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -272,12 +272,6 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
 	if ((error = git_config_get_string(&val, config, git_buf_cstr(&buf))) < 0)
 		goto cleanup;
 
-	if (strlen(val) == 0) {
-		giterr_set(GITERR_INVALID, "Malformed remote '%s' - missing URL", name);
-		error = -1;
-		goto cleanup;
-	}
-
 	remote->repo = repo;
 	remote->url = git__strdup(val);
 	GITERR_CHECK_ALLOC(remote->url);
diff --git a/tests-clar/network/remote/remotes.c b/tests-clar/network/remote/remotes.c
index 3c4fa96..dec6465 100644
--- a/tests-clar/network/remote/remotes.c
+++ b/tests-clar/network/remote/remotes.c
@@ -361,13 +361,15 @@ void test_network_remote_remotes__tagopt(void)
 	git_config_free(cfg);
 }
 
-void test_network_remote_remotes__cannot_load_with_an_empty_url(void)
+void test_network_remote_remotes__can_load_with_an_empty_url(void)
 {
 	git_remote *remote = NULL;
 
-	cl_git_fail(git_remote_load(&remote, _repo, "empty-remote-url"));
-	cl_assert(giterr_last()->klass == GITERR_INVALID);
-	cl_assert_equal_p(remote, NULL);
+	cl_git_pass(git_remote_load(&remote, _repo, "empty-remote-url"));
+
+	cl_git_fail(git_remote_connect(remote, GIT_DIRECTION_FETCH));
+
+	git_remote_free(remote);
 }
 
 void test_network_remote_remotes__check_structure_version(void)