Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-08-29 01:30:39 +0300
committerEdward Thomson <ethomson@microsoft.com>2015-08-29 01:40:02 +0300
commit6c9352bf30e97af5d646d92ceab1c7b0f4c7a1c4 (patch)
treec5ebd5511ad3bc7a48fef8b1f270e5228357f305 /tests/repo
parent810cabb9dfa57127e78cb47dbe8ea95943fb2642 (diff)
iterator: sort subdirs properly with pathlist
When given a pathlist, don't assume that directories sort before files. Walk through any list of entries sorting before us to make sure that we've exhausted all entries that *aren't* directories. Eg, if we're searching for 'foo/bar', and we have a 'foo.c', keep advancing the pathlist to keep looking for an entry prefixed with 'foo/'.
Diffstat (limited to 'tests/repo')
-rw-r--r--tests/repo/iterator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/repo/iterator.c b/tests/repo/iterator.c
index 8af7bc533..84dfbe113 100644
--- a/tests/repo/iterator.c
+++ b/tests/repo/iterator.c
@@ -26,7 +26,7 @@ static void expect_iterator_items(
const git_index_entry *entry;
int count, error;
int no_trees = !(git_iterator_flags(i) & GIT_ITERATOR_INCLUDE_TREES);
- bool v = false;
+ bool v = true;
if (expected_flat < 0) { v = true; expected_flat = -expected_flat; }
if (expected_total < 0) { v = true; expected_total = -expected_total; }
@@ -1236,8 +1236,11 @@ void test_repo_iterator__workdirfilelist(void)
cl_git_pass(git_vector_insert(&filelist, "c"));
cl_git_pass(git_vector_insert(&filelist, "D"));
cl_git_pass(git_vector_insert(&filelist, "e"));
+ cl_git_pass(git_vector_insert(&filelist, "k.a"));
+ cl_git_pass(git_vector_insert(&filelist, "k.b"));
cl_git_pass(git_vector_insert(&filelist, "k/1"));
cl_git_pass(git_vector_insert(&filelist, "k/a"));
+ cl_git_pass(git_vector_insert(&filelist, "kZZZZZZZ"));
cl_git_pass(git_vector_insert(&filelist, "L/1"));
g_repo = cl_git_sandbox_init("icase");
@@ -1284,8 +1287,11 @@ void test_repo_iterator__workdirfilelist_icase(void)
cl_git_pass(git_vector_insert(&filelist, "c"));
cl_git_pass(git_vector_insert(&filelist, "D"));
cl_git_pass(git_vector_insert(&filelist, "e"));
+ cl_git_pass(git_vector_insert(&filelist, "k.a"));
+ cl_git_pass(git_vector_insert(&filelist, "k.b"));
cl_git_pass(git_vector_insert(&filelist, "k/1"));
cl_git_pass(git_vector_insert(&filelist, "k/a"));
+ cl_git_pass(git_vector_insert(&filelist, "kZZZZ"));
cl_git_pass(git_vector_insert(&filelist, "L/1"));
g_repo = cl_git_sandbox_init("icase");