reset_helpers.c 580 Bytes
Newer Older
nulltoken committed
1 2 3
#include "clar_libgit2.h"
#include "reset_helpers.h"

Ben Straub committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
void reflog_check(git_repository *repo, const char *refname,
		size_t exp_count, const char *exp_email, const char *exp_msg)
{
	git_reflog *log;
	const git_reflog_entry *entry;

	cl_git_pass(git_reflog_read(&log, repo, refname));
	cl_assert_equal_i(exp_count, git_reflog_entrycount(log));
	entry = git_reflog_entry_byindex(log, 0);

	if (exp_email)
		cl_assert_equal_s(exp_email, git_reflog_entry_committer(entry)->email);
	if (exp_msg)
		cl_assert_equal_s(exp_msg, git_reflog_entry_message(entry));

	git_reflog_free(log);
}