diff options
author | Vicent Marti <vicent@github.com> | 2014-05-30 15:28:05 +0200 |
---|---|---|
committer | Vicent Marti <vicent@github.com> | 2014-05-30 15:28:05 +0200 |
commit | 58eea5ebf40b698cbaf028b23ee6157d5eb6582c (patch) | |
tree | d4cf828429124f3a9ca6970033cd1d4d6a474fd3 /tests | |
parent | 5f0527aeac65b10b0df9034f5763865d253daf75 (diff) | |
parent | 9d6c3d2853901f2fba049ba80cadb71caa8535c1 (diff) | |
download | libgit2-58eea5ebf40b698cbaf028b23ee6157d5eb6582c.tar.gz |
Merge pull request #2358 from arthurschreiber/arthur/normalize-ref-names-on-creation
Respect core.precomposeunicode = true in more cases.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/refs/branches/create.c | 3 | ||||
-rw-r--r-- | tests/refs/branches/move.c | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c index 864640ab3..3a4f33b6e 100644 --- a/tests/refs/branches/create.c +++ b/tests/refs/branches/create.c @@ -179,11 +179,14 @@ void test_refs_branches_create__can_create_branch_with_unicode(void) expected[0] = nfd; for (i = 0; i < ARRAY_SIZE(names); ++i) { + const char *name; cl_git_pass(git_branch_create( &branch, repo, names[i], target, 0, NULL, NULL)); cl_git_pass(git_oid_cmp( git_reference_target(branch), git_commit_id(target))); + cl_git_pass(git_branch_name(&name, branch)); + cl_assert_equal_s(expected[i], name); assert_branch_matches_name(expected[i], names[i]); if (fs_decompose_unicode && alt[i]) assert_branch_matches_name(expected[i], alt[i]); diff --git a/tests/refs/branches/move.c b/tests/refs/branches/move.c index 6c6dbbe21..f136b00d6 100644 --- a/tests/refs/branches/move.c +++ b/tests/refs/branches/move.c @@ -241,3 +241,20 @@ void test_refs_branches_move__default_reflog_message(void) git_reflog_free(log); git_signature_free(sig); } + +void test_refs_branches_move__can_move_with_unicode(void) +{ + git_reference *original_ref, *new_ref; + const char *new_branch_name = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D"; + + cl_git_pass(git_reference_lookup(&original_ref, repo, "refs/heads/br2")); + cl_git_pass(git_branch_move(&new_ref, original_ref, new_branch_name, 0, NULL, NULL)); + + if (cl_repo_get_bool(repo, "core.precomposeunicode")) + cl_assert_equal_s(GIT_REFS_HEADS_DIR "\xC3\x85\x73\x74\x72\xC3\xB6\x6D", git_reference_name(new_ref)); + else + cl_assert_equal_s(GIT_REFS_HEADS_DIR "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D", git_reference_name(new_ref)); + + git_reference_free(original_ref); + git_reference_free(new_ref); +} |