]>
Commit | Line | Data |
---|---|---|
99abb79d | 1 | #include "clar_libgit2.h" |
2 | #include "posix.h" | |
3 | ||
4 | static git_repository *repo; | |
5 | static git_strarray ref_list; | |
6 | ||
7 | static void ensure_no_refname_starts_with_a_forward_slash(const char *path) | |
8 | { | |
90e6c620 | 9 | size_t i; |
99abb79d | 10 | |
11 | cl_git_pass(git_repository_open(&repo, path)); | |
4fbd1c00 | 12 | cl_git_pass(git_reference_list(&ref_list, repo, GIT_REF_LISTALL)); |
99abb79d | 13 | |
14 | cl_assert(ref_list.count > 0); | |
15 | ||
16 | for (i = 0; i < ref_list.count; i++) | |
17 | cl_assert(git__prefixcmp(ref_list.strings[i], "/") != 0); | |
18 | ||
19 | git_strarray_free(&ref_list); | |
20 | git_repository_free(repo); | |
21 | } | |
22 | ||
23 | void test_refs_listall__from_repository_opened_through_workdir_path(void) | |
24 | { | |
25 | cl_fixture_sandbox("status"); | |
26 | cl_git_pass(p_rename("status/.gitted", "status/.git")); | |
27 | ||
28 | ensure_no_refname_starts_with_a_forward_slash("status"); | |
29 | ||
30 | cl_fixture_cleanup("status"); | |
31 | } | |
32 | ||
33 | void test_refs_listall__from_repository_opened_through_gitdir_path(void) | |
34 | { | |
35 | ensure_no_refname_starts_with_a_forward_slash(cl_fixture("testrepo.git")); | |
36 | } |