mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
remote: move the credentials callback to the struct
Move this one as well, letting us have a single way of setting the callbacks for the remote, and removing fields from the clone options.
This commit is contained in:
@@ -76,9 +76,9 @@ int do_clone(git_repository *repo, int argc, char **argv)
|
||||
checkout_opts.progress_payload = &pd;
|
||||
clone_opts.checkout_opts = checkout_opts;
|
||||
callbacks.transfer_progress = &fetch_progress;
|
||||
callbacks.credentials = cred_acquire_cb;
|
||||
callbacks.payload = &pd;
|
||||
clone_opts.remote_callbacks = &callbacks;
|
||||
clone_opts.cred_acquire_cb = cred_acquire_cb;
|
||||
|
||||
// Do the clone
|
||||
error = git_clone(&cloned_repo, url, path, &clone_opts);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user