Blame tests/blame/harder.c

Packit Service 20376f
#include "clar_libgit2.h"
Packit Service 20376f
Packit Service 20376f
#include "blame.h"
Packit Service 20376f
Packit Service 20376f
Packit Service 20376f
/**
Packit Service 20376f
 * The test repo has a history that looks like this:
Packit Service 20376f
 *
Packit Service 20376f
 * * (A) bc7c5ac
Packit Service 20376f
 * |\
Packit Service 20376f
 * | * (B) aa06ecc
Packit Service 20376f
 * * | (C) 63d671e
Packit Service 20376f
 * |/  
Packit Service 20376f
 * * (D) da23739
Packit Service 20376f
 * * (E) b99f7ac
Packit Service 20376f
 *
Packit Service 20376f
 */
Packit Service 20376f
Packit Service 20376f
static git_repository *g_repo = NULL;
Packit Service 20376f
Packit Service 20376f
void test_blame_harder__initialize(void)
Packit Service 20376f
{
Packit Service 20376f
	cl_git_pass(git_repository_open(&g_repo, cl_fixture("blametest.git")));
Packit Service 20376f
}
Packit Service 20376f
Packit Service 20376f
void test_blame_harder__cleanup(void)
Packit Service 20376f
{
Packit Service 20376f
	git_repository_free(g_repo);
Packit Service 20376f
	g_repo = NULL;
Packit Service 20376f
}
Packit Service 20376f
Packit Service 20376f
Packit Service 20376f
Packit Service 20376f
void test_blame_harder__m(void)
Packit Service 20376f
{
Packit Service 20376f
	/* TODO */
Packit Service 20376f
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
Packit Service 20376f
Packit Service 20376f
	GIT_UNUSED(opts);
Packit Service 20376f
Packit Service 20376f
	opts.flags = GIT_BLAME_TRACK_COPIES_SAME_FILE;
Packit Service 20376f
}
Packit Service 20376f
Packit Service 20376f
Packit Service 20376f
void test_blame_harder__c(void)
Packit Service 20376f
{
Packit Service 20376f
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
Packit Service 20376f
Packit Service 20376f
	GIT_UNUSED(opts);
Packit Service 20376f
Packit Service 20376f
	/* Attribute the first hunk in b.txt to (E), since it was cut/pasted from
Packit Service 20376f
	 * a.txt in (D).
Packit Service 20376f
	 */
Packit Service 20376f
	opts.flags = GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES;
Packit Service 20376f
}
Packit Service 20376f
Packit Service 20376f
void test_blame_harder__cc(void)
Packit Service 20376f
{
Packit Service 20376f
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
Packit Service 20376f
Packit Service 20376f
	GIT_UNUSED(opts);
Packit Service 20376f
Packit Service 20376f
	/* Attribute the second hunk in b.txt to (E), since it was copy/pasted from
Packit Service 20376f
	 * a.txt in (C).
Packit Service 20376f
	 */
Packit Service 20376f
	opts.flags = GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES;
Packit Service 20376f
}
Packit Service 20376f
Packit Service 20376f
void test_blame_harder__ccc(void)
Packit Service 20376f
{
Packit Service 20376f
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
Packit Service 20376f
Packit Service 20376f
	GIT_UNUSED(opts);
Packit Service 20376f
	
Packit Service 20376f
	/* Attribute the third hunk in b.txt to (E).  This hunk was deleted from
Packit Service 20376f
	 * a.txt in (D), but reintroduced in (B).
Packit Service 20376f
	 */
Packit Service 20376f
	opts.flags = GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES;
Packit Service 20376f
}