summaryrefslogtreecommitdiff
path: root/tests-clar/network
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2012-12-05 11:47:19 -0800
committerVicent Martí <vicent@github.com>2012-12-05 11:47:19 -0800
commite05ca13f1f3550f59790c0f992841abceee1b4c5 (patch)
treea01c119011d0c6020c9288096d09ed055c475bd8 /tests-clar/network
parenta541eafa606b58e7ce3df8e496da8e032fdb74ec (diff)
parentee1c33b146a366260a4648b1f29f470fedaca0fa (diff)
downloadlibgit2-e05ca13f1f3550f59790c0f992841abceee1b4c5.tar.gz
Merge pull request #1115 from ben/struct-versions
Version info for public structs
Diffstat (limited to 'tests-clar/network')
-rw-r--r--tests-clar/network/fetch.c4
-rw-r--r--tests-clar/network/push_util.h3
-rw-r--r--tests-clar/network/remotes.c20
3 files changed, 24 insertions, 3 deletions
diff --git a/tests-clar/network/fetch.c b/tests-clar/network/fetch.c
index 623352fa5..33c229316 100644
--- a/tests-clar/network/fetch.c
+++ b/tests-clar/network/fetch.c
@@ -36,10 +36,9 @@ static void progress(const git_transfer_progress *stats, void *payload)
static void do_fetch(const char *url, git_remote_autotag_option_t flag, int n)
{
git_remote *remote;
- git_remote_callbacks callbacks;
+ git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
size_t bytes_received = 0;
- memset(&callbacks, 0, sizeof(git_remote_callbacks));
callbacks.update_tips = update_tips;
counter = 0;
@@ -78,6 +77,7 @@ void test_network_fetch__no_tags_http(void)
static void transferProgressCallback(const git_transfer_progress *stats, void *payload)
{
+ GIT_UNUSED(stats);
bool *invoked = (bool *)payload;
GIT_UNUSED(stats);
diff --git a/tests-clar/network/push_util.h b/tests-clar/network/push_util.h
index 2f4dffce4..759122aa6 100644
--- a/tests-clar/network/push_util.h
+++ b/tests-clar/network/push_util.h
@@ -11,7 +11,8 @@ extern const git_oid OID_ZERO;
* record data in a record_callbacks_data instance.
* @param data pointer to a record_callbacks_data instance
*/
-#define RECORD_CALLBACKS_INIT(data) { NULL, NULL, record_update_tips_cb, data }
+#define RECORD_CALLBACKS_INIT(data) \
+ { GIT_REMOTE_CALLBACKS_VERSION, NULL, NULL, record_update_tips_cb, data }
typedef struct {
char *name;
diff --git a/tests-clar/network/remotes.c b/tests-clar/network/remotes.c
index b4a3ad99d..70df001e7 100644
--- a/tests-clar/network/remotes.c
+++ b/tests-clar/network/remotes.c
@@ -306,3 +306,23 @@ void test_network_remotes__cannot_load_with_an_empty_url(void)
cl_git_fail(git_remote_load(&remote, _repo, "empty-remote-url"));
cl_assert(giterr_last()->klass == GITERR_INVALID);
}
+
+void test_network_remotes__check_structure_version(void)
+{
+ git_transport transport = GIT_TRANSPORT_INIT;
+ const git_error *err;
+
+ git_remote_free(_remote);
+ cl_git_pass(git_remote_new(&_remote, _repo, NULL, "test-protocol://localhost", NULL));
+
+ transport.version = 0;
+ cl_git_fail(git_remote_set_transport(_remote, &transport));
+ err = giterr_last();
+ cl_assert_equal_i(GITERR_INVALID, err->klass);
+
+ giterr_clear();
+ transport.version = 1024;
+ cl_git_fail(git_remote_set_transport(_remote, &transport));
+ err = giterr_last();
+ cl_assert_equal_i(GITERR_INVALID, err->klass);
+}