diff options
author | Marc Strapetz <marc.strapetz@gmail.com> | 2016-03-22 10:29:12 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-03-24 15:59:49 -0400 |
commit | c017c183614e8b8fc84515b2ba802b80199920c6 (patch) | |
tree | a4242776659ef1ed540b6783387d80458b217b7d | |
parent | 09064f15c5c4efc0f4d9f4312e0aa4a11661ce4f (diff) | |
download | libgit2-c017c183614e8b8fc84515b2ba802b80199920c6.tar.gz |
iterator: new workdir-iterator test for pathlist + includings trees
-rw-r--r-- | tests/iterator/workdir.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/iterator/workdir.c b/tests/iterator/workdir.c index 389d8a1b6..3abaee65c 100644 --- a/tests/iterator/workdir.c +++ b/tests/iterator/workdir.c @@ -1430,3 +1430,29 @@ void test_iterator_workdir__pathlist_with_directory(void) git_vector_free(&filelist); } +void test_iterator_workdir__pathlist_with_directory_include_trees(void) +{ + git_iterator *i; + git_iterator_options i_opts = GIT_ITERATOR_OPTIONS_INIT; + git_vector filelist; + + const char *expected[] = { "subdir/", "subdir/README", "subdir/new.txt", + "subdir/subdir2/", "subdir/subdir2/README", "subdir/subdir2/new.txt", }; + size_t expected_len = 6; + + cl_git_pass(git_vector_init(&filelist, 100, &git__strcmp_cb)); + cl_git_pass(git_vector_insert(&filelist, "subdir/")); + + g_repo = cl_git_sandbox_init("testrepo2"); + + i_opts.pathlist.strings = (char **)filelist.contents; + i_opts.pathlist.count = filelist.length; + i_opts.flags |= GIT_ITERATOR_DONT_IGNORE_CASE | GIT_ITERATOR_INCLUDE_TREES; + + cl_git_pass(git_iterator_for_workdir(&i, g_repo, NULL, NULL, &i_opts)); + expect_iterator_items(i, expected_len, expected, expected_len, expected); + git_iterator_free(i); + + git_vector_free(&filelist); +} + |