]>
git.proxmox.com Git - libgit2.git/blob - tests/libgit2/refs/unicode.c
1 #include "clar_libgit2.h"
3 static git_repository
*repo
;
5 void test_refs_unicode__initialize(void)
7 repo
= cl_git_sandbox_init("testrepo.git");
10 void test_refs_unicode__cleanup(void)
12 cl_git_sandbox_cleanup();
16 void test_refs_unicode__create_and_lookup(void)
18 git_reference
*ref0
, *ref1
, *ref2
;
19 git_repository
*repo2
;
21 const char *REFNAME
= "refs/heads/" "\303\205" "ngstr" "\303\266" "m";
22 const char *master
= "refs/heads/master";
24 /* Create the reference */
25 cl_git_pass(git_reference_lookup(&ref0
, repo
, master
));
26 cl_git_pass(git_reference_create(
27 &ref1
, repo
, REFNAME
, git_reference_target(ref0
), 0, NULL
));
28 cl_assert_equal_s(REFNAME
, git_reference_name(ref1
));
29 git_reference_free(ref0
);
31 /* Lookup the reference in a different instance of the repository */
32 cl_git_pass(git_repository_open(&repo2
, "testrepo.git"));
34 cl_git_pass(git_reference_lookup(&ref2
, repo2
, REFNAME
));
35 cl_assert_equal_oid(git_reference_target(ref1
), git_reference_target(ref2
));
36 cl_assert_equal_s(REFNAME
, git_reference_name(ref2
));
37 git_reference_free(ref2
);
40 /* Lookup reference by decomposed unicode name */
42 #define REFNAME_DECOMPOSED "refs/heads/" "A" "\314\212" "ngstro" "\314\210" "m"
44 cl_git_pass(git_reference_lookup(&ref2
, repo2
, REFNAME_DECOMPOSED
));
45 cl_assert_equal_oid(git_reference_target(ref1
), git_reference_target(ref2
));
46 cl_assert_equal_s(REFNAME
, git_reference_name(ref2
));
47 git_reference_free(ref2
);
52 git_reference_free(ref1
);
53 git_repository_free(repo2
);