Commit de2af3c2 by Etienne Samson

remote: move static method

parent 0e5a27cd
......@@ -189,6 +189,26 @@ static int canonicalize_url(git_buf *out, const char *in)
return git_buf_puts(out, in);
}
static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
{
int error;
git_remote *remote;
error = git_remote_lookup(&remote, repo, name);
if (error == GIT_ENOTFOUND)
return 0;
if (error < 0)
return error;
git_remote_free(remote);
giterr_set(GITERR_CONFIG, "remote '%s' already exists", name);
return GIT_EEXISTS;
}
static int create_internal(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch)
{
git_remote *remote;
......@@ -270,29 +290,6 @@ on_error:
return error;
}
static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
{
int error;
git_remote *remote;
error = git_remote_lookup(&remote, repo, name);
if (error == GIT_ENOTFOUND)
return 0;
if (error < 0)
return error;
git_remote_free(remote);
giterr_set(
GITERR_CONFIG,
"remote '%s' already exists", name);
return GIT_EEXISTS;
}
int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url)
{
git_buf buf = GIT_BUF_INIT;
......
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