summaryrefslogtreecommitdiff
path: root/tests/blame/harder.c
blob: e777417205137da0c7c3aa6f1827e33b3474950f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "clar_libgit2.h"

#include "blame.h"


/**
 * The test repo has a history that looks like this:
 *
 * * (A) bc7c5ac
 * |\
 * | * (B) aa06ecc
 * * | (C) 63d671e
 * |/  
 * * (D) da23739
 * * (E) b99f7ac
 *
 */

static git_repository *g_repo = NULL;

void test_blame_harder__initialize(void)
{
	cl_git_pass(git_repository_open(&g_repo, cl_fixture("blametest.git")));
}

void test_blame_harder__cleanup(void)
{
	git_repository_free(g_repo);
	g_repo = NULL;
}



void test_blame_harder__m(void)
{
	/* TODO */
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;

	GIT_UNUSED(opts);

	opts.flags = GIT_BLAME_TRACK_COPIES_SAME_FILE;
}


void test_blame_harder__c(void)
{
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;

	GIT_UNUSED(opts);

	/* Attribute the first hunk in b.txt to (E), since it was cut/pasted from
	 * a.txt in (D).
	 */
	opts.flags = GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES;
}

void test_blame_harder__cc(void)
{
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;

	GIT_UNUSED(opts);

	/* Attribute the second hunk in b.txt to (E), since it was copy/pasted from
	 * a.txt in (C).
	 */
	opts.flags = GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES;
}

void test_blame_harder__ccc(void)
{
	git_blame_options opts = GIT_BLAME_OPTIONS_INIT;

	GIT_UNUSED(opts);
	
	/* Attribute the third hunk in b.txt to (E).  This hunk was deleted from
	 * a.txt in (D), but reintroduced in (B).
	 */
	opts.flags = GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES;
}