Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Garcia <victor@tuenti.com>2013-11-07 17:16:20 +0400
committerVictor Garcia <victor@tuenti.com>2013-11-07 17:16:20 +0400
commit0fe522d1057aef064084a22d116f7c225948a3bd (patch)
tree1fe257f593d9d5c2f220897eabd5a3660bba47bd /src/remote.c
parente87d9d3d4d8de9c048476387931c4ac57d1c2b73 (diff)
allowing create remote with custom fetch spec
Diffstat (limited to 'src/remote.c')
-rw-r--r--src/remote.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/remote.c b/src/remote.c
index 3528b1c46..b812c91dd 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -174,7 +174,7 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
}
-int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url)
+int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch)
{
git_buf buf = GIT_BUF_INIT;
git_remote *remote = NULL;
@@ -186,10 +186,13 @@ int git_remote_create(git_remote **out, git_repository *repo, const char *name,
if ((error = ensure_remote_doesnot_exist(repo, name)) < 0)
return error;
- if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0)
- return -1;
+ if (fetch == NULL) {
+ if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0)
+ return -1;
+ fetch = git_buf_cstr(&buf);
+ }
- if (create_internal(&remote, repo, name, url, git_buf_cstr(&buf)) < 0)
+ if (create_internal(&remote, repo, name, url, fetch) < 0)
goto on_error;
git_buf_free(&buf);