diff options
author | Russell Belfer <rb@github.com> | 2013-03-11 09:53:49 -0700 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2013-03-11 09:53:49 -0700 |
commit | 92028ea58541c9de69096bd6b1bbe664976c24c1 (patch) | |
tree | 1851fe1ac8dd9a774a5c4aeec92412222b725a1c /tests-clar/repo | |
parent | 61c7b61e6fe2542deeb8d2aadbea90a8f5b3c9cd (diff) | |
download | libgit2-92028ea58541c9de69096bd6b1bbe664976c24c1.tar.gz |
Fix tree iterator path for tree issue + cleanups
This fixes an off by one error for generating full paths for
tree entries in tree iterators when INCLUDE_TREES is set. Also,
contains a bunch of small code cleanups with a couple of small
utility functions and macro changes to eliminate redundant code.
Diffstat (limited to 'tests-clar/repo')
-rw-r--r-- | tests-clar/repo/iterator.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests-clar/repo/iterator.c b/tests-clar/repo/iterator.c index 804bc8324..e7498f67d 100644 --- a/tests-clar/repo/iterator.c +++ b/tests-clar/repo/iterator.c @@ -457,6 +457,10 @@ void test_repo_iterator__tree_case_conflicts(void) "A/1.file", "A/3.file", "a/2.file", "a/4.file" }; const char *expect_ci[] = { "A/1.file", "a/2.file", "A/3.file", "a/4.file" }; + const char *expect_cs_trees[] = { + "A/", "A/1.file", "A/3.file", "a/", "a/2.file", "a/4.file" }; + const char *expect_ci_trees[] = { + "A/", "A/1.file", "a/2.file", "A/3.file", "a/4.file" }; g_repo = cl_git_sandbox_init("icase"); @@ -482,6 +486,18 @@ void test_repo_iterator__tree_case_conflicts(void) expect_iterator_items(i, 4, expect_ci, 4, expect_ci); git_iterator_free(i); + cl_git_pass(git_iterator_for_tree( + &i, tree, GIT_ITERATOR_DONT_IGNORE_CASE | + GIT_ITERATOR_INCLUDE_TREES, NULL, NULL)); + expect_iterator_items(i, 6, expect_cs_trees, 6, expect_cs_trees); + git_iterator_free(i); + + cl_git_pass(git_iterator_for_tree( + &i, tree, GIT_ITERATOR_IGNORE_CASE | + GIT_ITERATOR_INCLUDE_TREES, NULL, NULL)); + expect_iterator_items(i, 5, expect_ci_trees, 5, expect_ci_trees); + git_iterator_free(i); + git_tree_free(tree); } |