Commit 9554cd51 by Carlos Martín Nieto

A remote exists with an URL alone

We used to consider it an error if a remote didn't have at least a
fetch refspec. This was too much checking, as a remote doesn't in fact
need to have anything other than an URL configured to be considered
a remote.
parent 1db9d2c3
...@@ -150,6 +150,9 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name) ...@@ -150,6 +150,9 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
} }
error = parse_remote_refspec(config, &remote->fetch, git_buf_cstr(&buf)); error = parse_remote_refspec(config, &remote->fetch, git_buf_cstr(&buf));
if (error == GIT_ENOTFOUND)
error = GIT_SUCCESS;
if (error < GIT_SUCCESS) { if (error < GIT_SUCCESS) {
error = git__rethrow(error, "Failed to get fetch refspec"); error = git__rethrow(error, "Failed to get fetch refspec");
goto cleanup; goto cleanup;
......
...@@ -101,3 +101,16 @@ void test_network_remotes__transform_r(void) ...@@ -101,3 +101,16 @@ void test_network_remotes__transform_r(void)
cl_assert(!strcmp(git_buf_cstr(&buf), "refs/remotes/test/master")); cl_assert(!strcmp(git_buf_cstr(&buf), "refs/remotes/test/master"));
git_buf_free(&buf); git_buf_free(&buf);
} }
void test_network_remotes__missing_refspecs(void)
{
git_config *cfg;
git_remote_free(_remote);
cl_git_pass(git_repository_config(&cfg, _repo));
cl_git_pass(git_config_set_string(cfg, "remote.specless.url", "http://example.com"));
cl_git_pass(git_remote_load(&_remote, _repo, "specless"));
git_config_free(cfg);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment