diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-09-16 05:02:25 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-10-02 06:41:42 +0200 |
commit | e3c131c544bc79573ebefab4931b5ca89836ace1 (patch) | |
tree | b64b640a89ad709ba63f31dcc5e6658552e14cb4 /tests-clar | |
parent | d31402a3fc4aa1b7d48ba43fd3bb072e7d69a527 (diff) | |
download | libgit2-e3c131c544bc79573ebefab4931b5ca89836ace1.tar.gz |
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.
Diffstat (limited to 'tests-clar')
-rw-r--r-- | tests-clar/online/clone.c | 13 | ||||
-rw-r--r-- | tests-clar/online/push.c | 3 | ||||
-rw-r--r-- | tests-clar/online/push_util.h | 2 |
3 files changed, 12 insertions, 6 deletions
diff --git a/tests-clar/online/clone.c b/tests-clar/online/clone.c index bda260858..b82cbcd46 100644 --- a/tests-clar/online/clone.c +++ b/tests-clar/online/clone.c @@ -155,11 +155,13 @@ void test_online_clone__credentials(void) cl_getenv("GITTEST_REMOTE_USER"), cl_getenv("GITTEST_REMOTE_PASS") }; + git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; if (!remote_url) return; - g_options.cred_acquire_cb = git_cred_userpass; - g_options.cred_acquire_payload = &user_pass; + callbacks.credentials = git_cred_userpass; + callbacks.payload = &user_pass; + g_options.remote_callbacks = &callbacks; cl_git_pass(git_clone(&g_repo, remote_url, "./foo", &g_options)); git_repository_free(g_repo); g_repo = NULL; @@ -172,8 +174,11 @@ void test_online_clone__bitbucket_style(void) "libgit2", "libgit2" }; - g_options.cred_acquire_cb = git_cred_userpass; - g_options.cred_acquire_payload = &user_pass; + git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT; + + callbacks.credentials = git_cred_userpass; + callbacks.payload = &user_pass; + g_options.remote_callbacks = &callbacks; cl_git_pass(git_clone(&g_repo, BB_REPO_URL, "./foo", &g_options)); git_repository_free(g_repo); g_repo = NULL; diff --git a/tests-clar/online/push.c b/tests-clar/online/push.c index d0d4ed05b..05cef56e7 100644 --- a/tests-clar/online/push.c +++ b/tests-clar/online/push.c @@ -17,6 +17,8 @@ static char *_remote_url; static char *_remote_user; static char *_remote_pass; +static int cred_acquire_cb(git_cred **, const char *, const char *, unsigned int, void *); + static git_remote *_remote; static bool _cred_acquire_called; static record_callbacks_data _record_cbs_data = {{ 0 }}; @@ -294,7 +296,6 @@ void test_online_push__initialize(void) if (_remote_url) { cl_git_pass(git_remote_create(&_remote, _repo, "test", _remote_url)); - git_remote_set_cred_acquire_cb(_remote, cred_acquire_cb, &_cred_acquire_called); record_callbacks_data_clear(&_record_cbs_data); git_remote_set_callbacks(_remote, &_record_cbs); diff --git a/tests-clar/online/push_util.h b/tests-clar/online/push_util.h index 659c6dd54..64f02cf2f 100644 --- a/tests-clar/online/push_util.h +++ b/tests-clar/online/push_util.h @@ -12,7 +12,7 @@ extern const git_oid OID_ZERO; * @param data pointer to a record_callbacks_data instance */ #define RECORD_CALLBACKS_INIT(data) \ - { GIT_REMOTE_CALLBACKS_VERSION, NULL, NULL, NULL, record_update_tips_cb, data } + { GIT_REMOTE_CALLBACKS_VERSION, NULL, NULL, cred_acquire_cb, NULL, record_update_tips_cb, data } typedef struct { char *name; |