summaryrefslogtreecommitdiff
path: root/src/clone.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/clone.c')
-rw-r--r--src/clone.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/clone.c b/src/clone.c
index 7e5d3302e..53cdae673 100644
--- a/src/clone.c
+++ b/src/clone.c
@@ -24,7 +24,7 @@
#include "repository.h"
#include "odb.h"
-static int clone_local_into(git_repository *repo, git_remote *remote, const git_checkout_options *co_opts, const char *branch, int link);
+static int clone_local_into(git_repository *repo, git_remote *remote, const git_fetch_options *fetch_opts, const git_checkout_options *co_opts, const char *branch, int link);
static int create_branch(
git_reference **branch,
@@ -242,13 +242,9 @@ static int default_remote_create(
const char *url,
void *payload)
{
- int error;
- git_remote_callbacks *callbacks = payload;
-
- if ((error = git_remote_create(out, repo, name, url)) < 0)
- return error;
+ GIT_UNUSED(payload);
- return git_remote_set_callbacks(*out, callbacks);
+ return git_remote_create(out, repo, name, url);
}
/*
@@ -277,7 +273,7 @@ static int create_and_configure_origin(
if (!remote_create) {
remote_create = default_remote_create;
- payload = (void *)&options->remote_callbacks;
+ payload = NULL;
}
if ((error = remote_create(&origin, repo, "origin", url, payload)) < 0)
@@ -328,12 +324,11 @@ static int checkout_branch(git_repository *repo, git_remote *remote, const git_c
return error;
}
-static int clone_into(git_repository *repo, git_remote *_remote, const git_checkout_options *co_opts, const char *branch)
+static int clone_into(git_repository *repo, git_remote *_remote, const git_fetch_options *opts, const git_checkout_options *co_opts, const char *branch)
{
int error;
git_buf reflog_message = GIT_BUF_INIT;
git_remote *remote;
- const git_remote_callbacks *callbacks;
assert(repo && _remote);
@@ -345,18 +340,13 @@ static int clone_into(git_repository *repo, git_remote *_remote, const git_check
if ((error = git_remote_dup(&remote, _remote)) < 0)
return error;
- callbacks = git_remote_get_callbacks(_remote);
- if (!giterr__check_version(callbacks, 1, "git_remote_callbacks") &&
- (error = git_remote_set_callbacks(remote, callbacks)) < 0)
- goto cleanup;
-
if ((error = git_remote_add_fetch(remote, "refs/tags/*:refs/tags/*")) < 0)
goto cleanup;
git_remote_set_update_fetchhead(remote, 0);
git_buf_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
- if ((error = git_remote_fetch(remote, NULL, git_buf_cstr(&reflog_message))) != 0)
+ if ((error = git_remote_fetch(remote, NULL, opts, git_buf_cstr(&reflog_message))) != 0)
goto cleanup;
error = checkout_branch(repo, remote, co_opts, branch, git_buf_cstr(&reflog_message));
@@ -439,11 +429,11 @@ int git_clone(
if (clone_local == 1)
error = clone_local_into(
- repo, origin, &options.checkout_opts,
+ repo, origin, &options.fetch_opts, &options.checkout_opts,
options.checkout_branch, link);
else if (clone_local == 0)
error = clone_into(
- repo, origin, &options.checkout_opts,
+ repo, origin, &options.fetch_opts, &options.checkout_opts,
options.checkout_branch);
else
error = -1;
@@ -506,7 +496,7 @@ static bool can_link(const char *src, const char *dst, int link)
#endif
}
-static int clone_local_into(git_repository *repo, git_remote *remote, const git_checkout_options *co_opts, const char *branch, int link)
+static int clone_local_into(git_repository *repo, git_remote *remote, const git_fetch_options *fetch_opts, const git_checkout_options *co_opts, const char *branch, int link)
{
int error, flags;
git_repository *src;
@@ -551,7 +541,7 @@ static int clone_local_into(git_repository *repo, git_remote *remote, const git_
git_buf_printf(&reflog_message, "clone: from %s", git_remote_url(remote));
- if ((error = git_remote_fetch(remote, NULL, git_buf_cstr(&reflog_message))) != 0)
+ if ((error = git_remote_fetch(remote, NULL, fetch_opts, git_buf_cstr(&reflog_message))) != 0)
goto cleanup;
error = checkout_branch(repo, remote, co_opts, branch, git_buf_cstr(&reflog_message));