Skip to content

Commit de2af3c

Browse files
committed
remote: move static method
1 parent 0e5a27c commit de2af3c

File tree

1 file changed

+20
-23
lines changed

1 file changed

+20
-23
lines changed

src/remote.c

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,26 @@ static int canonicalize_url(git_buf *out, const char *in)
189189
return git_buf_puts(out, in);
190190
}
191191

192+
static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
193+
{
194+
int error;
195+
git_remote *remote;
196+
197+
error = git_remote_lookup(&remote, repo, name);
198+
199+
if (error == GIT_ENOTFOUND)
200+
return 0;
201+
202+
if (error < 0)
203+
return error;
204+
205+
git_remote_free(remote);
206+
207+
giterr_set(GITERR_CONFIG, "remote '%s' already exists", name);
208+
209+
return GIT_EEXISTS;
210+
}
211+
192212
static int create_internal(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch)
193213
{
194214
git_remote *remote;
@@ -270,29 +290,6 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
270290
return error;
271291
}
272292

273-
static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
274-
{
275-
int error;
276-
git_remote *remote;
277-
278-
error = git_remote_lookup(&remote, repo, name);
279-
280-
if (error == GIT_ENOTFOUND)
281-
return 0;
282-
283-
if (error < 0)
284-
return error;
285-
286-
git_remote_free(remote);
287-
288-
giterr_set(
289-
GITERR_CONFIG,
290-
"remote '%s' already exists", name);
291-
292-
return GIT_EEXISTS;
293-
}
294-
295-
296293
int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url)
297294
{
298295
git_buf buf = GIT_BUF_INIT;

0 commit comments

Comments
 (0)