diff options
author | Russell Belfer <rb@github.com> | 2013-10-08 16:35:57 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-10-08 16:35:57 -0700 |
commit | 92dac975869bf6207eca0754345dc9aa7fec8992 (patch) | |
tree | d210c8864e8cb2fba474b70057ed4655fda5535b /tests-clar/refs/unicode.c | |
parent | d5e83627e4ed764115175dc42090afe0df332fe3 (diff) | |
download | libgit2-92dac975869bf6207eca0754345dc9aa7fec8992.tar.gz |
Make reference lookups apply precomposeunicode
Before these changes, looking up a reference would return the
same precomposed or decomposed form of the reference name that
was used to look it up, so on MacOS which ignores the difference
between the two, a single reference could be looked up either way
and git_reference_name would return the form of the name that was
used to look it up! This change makes lookup always return the
precomposed name if core.precomposeunicode is set regardless of
which version was used to look it up. The reference iterator was
already returning the precomposed form from earlier work.
This also updates the CMakeLists.txt rules for enabling iconv
usage because the clar tests for this code were actually not being
activated properly with the old version.
Finally, this moves git_repository_reset_filesystem from include/
git2/repository.h to include/git2/sys/repository.h since it is not
really a function that normal library users should have to think
about very often.
Diffstat (limited to 'tests-clar/refs/unicode.c')
-rw-r--r-- | tests-clar/refs/unicode.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/tests-clar/refs/unicode.c b/tests-clar/refs/unicode.c index b29c63e2b..b56012869 100644 --- a/tests-clar/refs/unicode.c +++ b/tests-clar/refs/unicode.c @@ -4,17 +4,13 @@ static git_repository *repo; void test_refs_unicode__initialize(void) { - cl_fixture_sandbox("testrepo.git"); - - cl_git_pass(git_repository_open(&repo, "testrepo.git")); + repo = cl_git_sandbox_init("testrepo.git"); } void test_refs_unicode__cleanup(void) { - git_repository_free(repo); + cl_git_sandbox_cleanup(); repo = NULL; - - cl_fixture_cleanup("testrepo.git"); } void test_refs_unicode__create_and_lookup(void) @@ -23,13 +19,12 @@ void test_refs_unicode__create_and_lookup(void) git_repository *repo2; const char *REFNAME = "refs/heads/" "\303\205" "ngstr" "\303\266" "m"; - const char *REFNAME_DECOMPOSED = - "refs/heads/" "A" "\314\212" "ngstro" "\314\210" "m"; const char *master = "refs/heads/master"; /* Create the reference */ cl_git_pass(git_reference_lookup(&ref0, repo, master)); - cl_git_pass(git_reference_create(&ref1, repo, REFNAME, git_reference_target(ref0), 0)); + cl_git_pass(git_reference_create( + &ref1, repo, REFNAME, git_reference_target(ref0), 0)); cl_assert_equal_s(REFNAME, git_reference_name(ref1)); git_reference_free(ref0); @@ -45,6 +40,8 @@ void test_refs_unicode__create_and_lookup(void) #if GIT_USE_ICONV /* Lookup reference by decomposed unicode name */ +#define REFNAME_DECOMPOSED "refs/heads/" "A" "\314\212" "ngstro" "\314\210" "m" + cl_git_pass(git_reference_lookup(&ref2, repo2, REFNAME_DECOMPOSED)); cl_assert_equal_i( 0, git_oid_cmp(git_reference_target(ref1), git_reference_target(ref2))); |