]> git.proxmox.com Git - libgit2.git/blob - tests/refs/dup.c
0fc635a7aa5c7dbc9d408a167d27905efdc4f566
[libgit2.git] / tests / refs / dup.c
1 #include "clar_libgit2.h"
2 #include "refs.h"
3
4 static git_repository *g_repo;
5
6 void test_refs_dup__initialize(void)
7 {
8 g_repo = cl_git_sandbox_init("testrepo.git");
9 }
10
11 void test_refs_dup__cleanup(void)
12 {
13 cl_git_sandbox_cleanup();
14 }
15
16 void test_refs_dup__direct(void)
17 {
18 git_reference *a, *b;
19
20 cl_git_pass(git_reference_lookup(&a, g_repo, "refs/heads/master"));
21 cl_git_pass(git_reference_dup(&b, a));
22
23 cl_assert(git_reference_cmp(a, b) == 0);
24
25 git_reference_free(b);
26 git_reference_free(a);
27 }
28
29 void test_refs_dup__symbolic(void)
30 {
31 git_reference *a, *b;
32
33 cl_git_pass(git_reference_lookup(&a, g_repo, "HEAD"));
34 cl_git_pass(git_reference_dup(&b, a));
35
36 cl_assert(git_reference_cmp(a, b) == 0);
37
38 git_reference_free(b);
39 git_reference_free(a);
40 }