]>
git.proxmox.com Git - libgit2.git/blob - tests/refs/list.c
1 #include "clar_libgit2.h"
3 #include "repository.h"
4 #include "git2/reflog.h"
7 static git_repository
*g_repo
;
11 void test_refs_list__initialize(void)
13 g_repo
= cl_git_sandbox_init("testrepo");
16 void test_refs_list__cleanup(void)
18 cl_git_sandbox_cleanup();
23 void test_refs_list__all(void)
25 /* try to list all the references in our test repo */
26 git_strarray ref_list
;
28 cl_git_pass(git_reference_list(&ref_list
, g_repo
));
32 for (i = 0; i < ref_list.count; ++i)
33 printf("# %s\n", ref_list.strings[i]);
36 /* We have exactly 12 refs in total if we include the packed ones:
37 * there is a reference that exists both in the packfile and as
38 * loose, but we only list it once */
39 cl_assert_equal_i((int)ref_list
.count
, 19);
41 git_strarray_dispose(&ref_list
);
44 void test_refs_list__do_not_retrieve_references_which_name_end_with_a_lock_extension(void)
46 git_strarray ref_list
;
48 /* Create a fake locked reference */
50 "./testrepo/.git/refs/heads/hanwen.lock",
51 "144344043ba4d4a405da03de3844aa829ae8be0e\n");
53 cl_git_pass(git_reference_list(&ref_list
, g_repo
));
54 cl_assert_equal_i((int)ref_list
.count
, 19);
56 git_strarray_dispose(&ref_list
);