summaryrefslogtreecommitdiff
path: root/tests-clar/diff/iterator.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-18 17:24:13 -0700
committerRussell Belfer <rb@github.com>2013-03-18 17:24:13 -0700
commit65025cb8934a289460bc64f82c27027c68a85be6 (patch)
tree4b945ad28ff220ffa8500275a5e7a635749e3d11 /tests-clar/diff/iterator.c
parent5b27bf7e5bfd5c2f92a15c0058c801d49faf8403 (diff)
downloadlibgit2-65025cb8934a289460bc64f82c27027c68a85be6.tar.gz
Three submodule status bug fixes
1. Fix sort order problem with submodules where "mod" was sorting after "mod-plus" because they were being sorted as "mod/" and "mod-plus/". This involved pushing the "contains a .git entry" test significantly lower in the stack. 2. Reinstate behavior that a directory which contains a .git entry will be treated as a submodule during iteration even if it is not yet added to the .gitmodules. 3. Now that any directory containing .git is reported as submodule, we have to be more careful checking for GIT_EEXISTS when we do a submodule lookup, because that is the error code that is returned by git_submodule_lookup when you try to look up a directory containing .git that has no record in gitmodules or the index.
Diffstat (limited to 'tests-clar/diff/iterator.c')
-rw-r--r--tests-clar/diff/iterator.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests-clar/diff/iterator.c b/tests-clar/diff/iterator.c
index f1efdfbba..15b10465a 100644
--- a/tests-clar/diff/iterator.c
+++ b/tests-clar/diff/iterator.c
@@ -720,13 +720,13 @@ void test_diff_iterator__workdir_builtin_ignores(void)
{ "root_test2", false },
{ "root_test3", false },
{ "root_test4.txt", false },
- { "sub/", false },
+ { "sub", false },
{ "sub/.gitattributes", false },
{ "sub/abc", false },
{ "sub/dir/", true },
{ "sub/file", false },
{ "sub/ign/", true },
- { "sub/sub/", false },
+ { "sub/sub", false },
{ "sub/sub/.gitattributes", false },
{ "sub/sub/dir", false }, /* file is not actually a dir */
{ "sub/sub/file", false },
@@ -746,9 +746,13 @@ void test_diff_iterator__workdir_builtin_ignores(void)
cl_assert_equal_s(expected[idx].path, entry->path);
cl_assert_(ignored == expected[idx].ignored, expected[idx].path);
- if (!ignored && S_ISDIR(entry->mode))
+ if (!ignored &&
+ (entry->mode == GIT_FILEMODE_TREE ||
+ entry->mode == GIT_FILEMODE_COMMIT))
+ {
+ /* it is possible to advance "into" a submodule */
cl_git_pass(git_iterator_advance_into(&entry, i));
- else
+ } else
cl_git_pass(git_iterator_advance(&entry, i));
}