diff options
| author | Vicent Martà <vicent@github.com> | 2013-10-02 05:56:37 -0700 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2013-10-02 05:56:37 -0700 |
| commit | 5bfead1dba919f6b47f52da675ea94407e8baf49 (patch) | |
| tree | 4b879238df61eccc2f048fe51e10fce421967e26 /examples | |
| parent | 71e33d2649f990086237a6cd0fdb7f7d6f742b51 (diff) | |
| parent | 0e0cf78773bea0d06298ba3bf981a3be839041df (diff) | |
| download | libgit2-5bfead1dba919f6b47f52da675ea94407e8baf49.tar.gz | |
Merge pull request #1855 from libgit2/cmn/clone-into
An alternative for 'clone' with options
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/network/clone.c | 6 | ||||
| -rw-r--r-- | examples/network/fetch.c | 4 | ||||
| -rw-r--r-- | examples/network/ls-remote.c | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/examples/network/clone.c b/examples/network/clone.c index a09a94728..db35bd7db 100644 --- a/examples/network/clone.c +++ b/examples/network/clone.c @@ -74,9 +74,9 @@ int do_clone(git_repository *repo, int argc, char **argv) checkout_opts.progress_cb = checkout_progress; checkout_opts.progress_payload = &pd; clone_opts.checkout_opts = checkout_opts; - clone_opts.fetch_progress_cb = &fetch_progress; - clone_opts.fetch_progress_payload = &pd; - clone_opts.cred_acquire_cb = cred_acquire_cb; + clone_opts.remote_callbacks.transfer_progress = &fetch_progress; + clone_opts.remote_callbacks.credentials = cred_acquire_cb; + clone_opts.remote_callbacks.payload = &pd; // Do the clone error = git_clone(&cloned_repo, url, path, &clone_opts); diff --git a/examples/network/fetch.c b/examples/network/fetch.c index ce016ce0b..0c545ad7e 100644 --- a/examples/network/fetch.c +++ b/examples/network/fetch.c @@ -35,7 +35,7 @@ static void *download(void *ptr) // Download the packfile and index it. This function updates the // amount of received data and the indexer stats which lets you // inform the user about progress. - if (git_remote_download(data->remote, NULL, NULL) < 0) { + if (git_remote_download(data->remote) < 0) { data->ret = -1; goto exit; } @@ -91,8 +91,8 @@ int fetch(git_repository *repo, int argc, char **argv) // Set up the callbacks (only update_tips for now) callbacks.update_tips = &update_cb; callbacks.progress = &progress_cb; + callbacks.credentials = cred_acquire_cb; git_remote_set_callbacks(remote, &callbacks); - git_remote_set_cred_acquire_cb(remote, &cred_acquire_cb, NULL); // Set up the information for the background worker thread data.remote = remote; diff --git a/examples/network/ls-remote.c b/examples/network/ls-remote.c index b22ac47a0..b65759ed3 100644 --- a/examples/network/ls-remote.c +++ b/examples/network/ls-remote.c @@ -18,6 +18,7 @@ static int use_remote(git_repository *repo, char *name) { git_remote *remote = NULL; int error; + git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; // Find the remote by name error = git_remote_load(&remote, repo, name); @@ -27,7 +28,8 @@ static int use_remote(git_repository *repo, char *name) goto cleanup; } - git_remote_set_cred_acquire_cb(remote, &cred_acquire_cb, NULL); + callbacks.credentials = cred_acquire_cb; + git_remote_set_callbacks(remote, &callbacks); error = git_remote_connect(remote, GIT_DIRECTION_FETCH); if (error < 0) |
