diff options
author | Vicent Martà <vicent@github.com> | 2012-07-27 09:52:44 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2012-07-27 09:52:44 -0700 |
commit | 60d5cc57473ad6ecf05f50d15bb101e3348897f0 (patch) | |
tree | 27773ac98806290b456cf3f29a5dd4ede40c5895 /src | |
parent | f0244463ad280664d2cac950fcc5d6ff550905d1 (diff) | |
parent | b3aaa7a7c887006d38b7262b73575d40f51beca5 (diff) | |
download | libgit2-60d5cc57473ad6ecf05f50d15bb101e3348897f0.tar.gz |
Merge pull request #834 from carlosmn/network-callbacks
Add a struct for network callbacks
Diffstat (limited to 'src')
-rw-r--r-- | src/remote.c | 13 | ||||
-rw-r--r-- | src/remote.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/remote.c b/src/remote.c index c479c19c8..c2bfb09bb 100644 --- a/src/remote.c +++ b/src/remote.c @@ -423,7 +423,7 @@ int git_remote_download(git_remote *remote, git_off_t *bytes, git_indexer_stats return git_fetch_download_pack(remote, bytes, stats); } -int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, const git_oid *a, const git_oid *b)) +int git_remote_update_tips(git_remote *remote) { int error = 0; unsigned int i = 0; @@ -473,8 +473,8 @@ int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, co git_reference_free(ref); - if (cb != NULL) { - if (cb(refname.ptr, &old, &head->oid) < 0) + if (remote->callbacks.update_tips != NULL) { + if (remote->callbacks.update_tips(refname.ptr, &old, &head->oid, remote->callbacks.data) < 0) goto on_error; } } @@ -618,3 +618,10 @@ void git_remote_check_cert(git_remote *remote, int check) remote->check_cert = check; } + +void git_remote_set_callbacks(git_remote *remote, git_remote_callbacks *callbacks) +{ + assert(remote && callbacks); + + memcpy(&remote->callbacks, callbacks, sizeof(git_remote_callbacks)); +} diff --git a/src/remote.h b/src/remote.h index 623d40c87..5083b9912 100644 --- a/src/remote.h +++ b/src/remote.h @@ -20,6 +20,7 @@ struct git_remote { struct git_refspec push; git_transport *transport; git_repository *repo; + git_remote_callbacks callbacks; unsigned int need_pack:1, check_cert; }; |