tests-clar/network/push.c
static void do_push(const char *refspecs[], size_t refspecs_len,
	push_status expected_statuses[], size_t expected_statuses_len,
	expected_ref expected_refs[], size_t expected_refs_len, int expected_ret)
{
	git_push *push;
	size_t i;
	int ret;

	if (_remote) {
		cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_PUSH));

		cl_git_pass(git_push_new(&push, _remote));

		for (i = 0; i < refspecs_len; i++)
			cl_git_pass(git_push_add_refspec(push, refspecs[i]));

		if (expected_ret < 0) {
			cl_git_fail(ret = git_push_finish(push));
			cl_assert_equal_i(0, git_push_unpack_ok(push));
		}
		else {
			cl_git_pass(ret = git_push_finish(push));
			cl_assert_equal_i(1, git_push_unpack_ok(push));
		}

		do_verify_push_status(push, expected_statuses, expected_statuses_len);

		cl_assert_equal_i(expected_ret, ret);

		git_push_free(push);

		verify_refs(_remote, expected_refs, expected_refs_len);

		cl_git_pass(git_remote_update_tips(_remote));

		git_remote_disconnect(_remote);
	}
}
/**
 * Calls push and relists refs on remote to verify success.
 * 
 * @param refspecs refspecs to push
 * @param refspecs_len length of refspecs
 * @param expected_refs expected remote refs after push
 * @param expected_refs_len length of expected_refs
 * @param expected_ret expected return value from git_push_finish()
 */
Calls push and relists refs on remote to verify success.


Calls push and relists refs on remote to verify success .
static void do_push(const char *refspecs[], size_t refspecs_len,
	push_status expected_statuses[], size_t expected_statuses_len,
	expected_ref expected_refs[], size_t expected_refs_len, int expected_ret)
{
	git_push *push;
	size_t i;
	int ret;
	if (_remote) {
		cl_git_pass(git_remote_connect(_remote, GIT_DIRECTION_PUSH));
		cl_git_pass(git_push_new(&push, _remote));
		for (i = 0; i < refspecs_len; i++)
			cl_git_pass(git_push_add_refspec(push, refspecs[i]));
		if (expected_ret < 0) {
			cl_git_fail(ret = git_push_finish(push));
			cl_assert_equal_i(0, git_push_unpack_ok(push));
		}
		else {
			cl_git_pass(ret = git_push_finish(push));
			cl_assert_equal_i(1, git_push_unpack_ok(push));
		}
		do_verify_push_status(push, expected_statuses, expected_statuses_len);
		cl_assert_equal_i(expected_ret, ret);
		git_push_free(push);
		verify_refs(_remote, expected_refs, expected_refs_len);
		cl_git_pass(git_remote_update_tips(_remote));
		git_remote_disconnect(_remote);
	}
}
static void do_push ( const char * refspecs [ ] , size_t refspecs_len , push_status expected_statuses [ ] , size_t expected_statuses_len , expected_ref expected_refs [ ] , size_t expected_refs_len , int expected_ret ) { git_push * push ; size_t i ; int ret ; if ( _remote ) { cl_git_pass ( git_remote_connect ( _remote , GIT_DIRECTION_PUSH ) ) ; cl_git_pass ( git_push_new ( & push , _remote ) ) ; for ( i = 0 ; i < refspecs_len ; i ++ ) cl_git_pass ( git_push_add_refspec ( push , refspecs [ i ] ) ) ; if ( expected_ret < 0 ) { cl_git_fail ( ret = git_push_finish ( push ) ) ; cl_assert_equal_i ( 0 , git_push_unpack_ok ( push ) ) ; } else { cl_git_pass ( ret = git_push_finish ( push ) ) ; cl_assert_equal_i ( 1 , git_push_unpack_ok ( push ) ) ; } do_verify_push_status ( push , expected_statuses , expected_statuses_len ) ; cl_assert_equal_i ( expected_ret , ret ) ; git_push_free ( push ) ; verify_refs ( _remote , expected_refs , expected_refs_len ) ; cl_git_pass ( git_remote_update_tips ( _remote ) ) ; git_remote_disconnect ( _remote ) ; } }
Calls push and relists refs on remote to verify success.
Calls push and relists refs on remote to verify success .