diff options
| author | Vicent Martà <vicent@github.com> | 2012-12-14 13:53:50 -0800 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2012-12-14 13:53:50 -0800 |
| commit | be5869fce0ab9c61a294020e9baa9755c58ee8a3 (patch) | |
| tree | 731eff52328710a47cd702b63430c575e1bfb999 /src | |
| parent | 37ac44366bc2a400c993d6b3367bfdd3262e840c (diff) | |
| parent | b9e7e2b4e148deb90119d4c2c52d8d9e889527cd (diff) | |
| download | libgit2-be5869fce0ab9c61a294020e9baa9755c58ee8a3.tar.gz | |
Merge pull request #1143 from ben/clone-options
Options structure for git_clone
Diffstat (limited to 'src')
| -rw-r--r-- | src/clone.c | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/src/clone.c b/src/clone.c index aa6c43f86..865521bce 100644 --- a/src/clone.c +++ b/src/clone.c @@ -355,42 +355,25 @@ static int clone_internal( return retcode; } -int git_clone_bare( - git_repository **out, - git_remote *origin_remote, - const char *dest_path, - git_transfer_progress_callback fetch_progress_cb, - void *fetch_progress_payload) +int git_clone( + git_repository **out, + git_remote *origin, + const char *local_path, + const git_clone_options *options) { - assert(out && origin_remote && dest_path); - - return clone_internal( - out, - origin_remote, - dest_path, - fetch_progress_cb, - fetch_progress_payload, - NULL, - 1); -} + git_clone_options dummy_options = GIT_CLONE_OPTIONS_INIT; + assert(out && origin && local_path); + if (!options) options = &dummy_options; -int git_clone( - git_repository **out, - git_remote *origin_remote, - const char *workdir_path, - git_checkout_opts *checkout_opts, - git_transfer_progress_callback fetch_progress_cb, - void *fetch_progress_payload) -{ - assert(out && origin_remote && workdir_path); + GITERR_CHECK_VERSION(options, GIT_CLONE_OPTIONS_VERSION, "git_clone_options"); return clone_internal( out, - origin_remote, - workdir_path, - fetch_progress_cb, - fetch_progress_payload, - checkout_opts, - 0); + origin, + local_path, + options->fetch_progress_cb, + options->fetch_progress_payload, + options->checkout_opts, + options->bare ? 1 : 0); } |
