forked from libgit2/libgit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdup.c
42 lines (31 loc) · 838 Bytes
/
dup.c
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
#include "clar_libgit2.h"
#include "refs.h"
static git_repository *g_repo;
void test_refs_dup__initialize(void)
{
g_repo = cl_git_sandbox_init("testrepo.git");
}
void test_refs_dup__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_refs_dup__direct(void)
{
git_reference *a, *b;
cl_git_pass(git_reference_lookup(&a, g_repo, "refs/heads/master"));
cl_git_pass(git_reference_dup(&b, a));
cl_assert(git_reference_cmp(a, b) == 0);
cl_assert(git_reference_owner(b) == g_repo);
git_reference_free(b);
git_reference_free(a);
}
void test_refs_dup__symbolic(void)
{
git_reference *a, *b;
cl_git_pass(git_reference_lookup(&a, g_repo, "HEAD"));
cl_git_pass(git_reference_dup(&b, a));
cl_assert(git_reference_cmp(a, b) == 0);
cl_assert(git_reference_owner(b) == g_repo);
git_reference_free(b);
git_reference_free(a);
}