]>
Commit | Line | Data |
---|---|---|
ceab4e26 BS |
1 | #include "clar_libgit2.h" |
2 | ||
3 | #include "blame.h" | |
4 | ||
5 | ||
6 | /** | |
7 | * The test repo has a history that looks like this: | |
8 | * | |
9 | * * (A) bc7c5ac | |
10 | * |\ | |
11 | * | * (B) aa06ecc | |
12 | * * | (C) 63d671e | |
13 | * |/ | |
14 | * * (D) da23739 | |
15 | * * (E) b99f7ac | |
16 | * | |
17 | */ | |
18 | ||
19 | static git_repository *g_repo = NULL; | |
20 | ||
21 | void test_blame_harder__initialize(void) | |
22 | { | |
23 | cl_git_pass(git_repository_open(&g_repo, cl_fixture("blametest.git"))); | |
24 | } | |
25 | ||
26 | void test_blame_harder__cleanup(void) | |
27 | { | |
28 | git_repository_free(g_repo); | |
29 | g_repo = NULL; | |
30 | } | |
31 | ||
32 | ||
33 | ||
34 | void test_blame_harder__m(void) | |
35 | { | |
36 | /* TODO */ | |
37 | git_blame_options opts = GIT_BLAME_OPTIONS_INIT; | |
38 | ||
5588f073 ET |
39 | GIT_UNUSED(opts); |
40 | ||
ceab4e26 BS |
41 | opts.flags = GIT_BLAME_TRACK_COPIES_SAME_FILE; |
42 | } | |
43 | ||
44 | ||
45 | void test_blame_harder__c(void) | |
46 | { | |
47 | git_blame_options opts = GIT_BLAME_OPTIONS_INIT; | |
48 | ||
5588f073 ET |
49 | GIT_UNUSED(opts); |
50 | ||
ceab4e26 BS |
51 | /* Attribute the first hunk in b.txt to (E), since it was cut/pasted from |
52 | * a.txt in (D). | |
53 | */ | |
54 | opts.flags = GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES; | |
55 | } | |
56 | ||
57 | void test_blame_harder__cc(void) | |
58 | { | |
59 | git_blame_options opts = GIT_BLAME_OPTIONS_INIT; | |
60 | ||
5588f073 ET |
61 | GIT_UNUSED(opts); |
62 | ||
ceab4e26 BS |
63 | /* Attribute the second hunk in b.txt to (E), since it was copy/pasted from |
64 | * a.txt in (C). | |
65 | */ | |
66 | opts.flags = GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES; | |
67 | } | |
68 | ||
69 | void test_blame_harder__ccc(void) | |
70 | { | |
71 | git_blame_options opts = GIT_BLAME_OPTIONS_INIT; | |
5588f073 ET |
72 | |
73 | GIT_UNUSED(opts); | |
ceab4e26 BS |
74 | |
75 | /* Attribute the third hunk in b.txt to (E). This hunk was deleted from | |
76 | * a.txt in (D), but reintroduced in (B). | |
77 | */ | |
78 | opts.flags = GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES; | |
79 | } |