summaryrefslogtreecommitdiff
path: root/tests-clar/diff/workdir.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/workdir.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/workdir.c')
-rw-r--r--tests-clar/diff/workdir.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/tests-clar/diff/workdir.c b/tests-clar/diff/workdir.c
index 7e8915c4b..983465b29 100644
--- a/tests-clar/diff/workdir.c
+++ b/tests-clar/diff/workdir.c
@@ -936,7 +936,8 @@ void test_diff_workdir__submodules(void)
p_rename("submod2_target/.gitted", "submod2_target/.git");
rewrite_gitmodules(git_repository_workdir(g_repo));
- p_rename("submod2/not_submodule/.gitted", "submod2/not_submodule/.git");
+ p_rename("submod2/not-submodule/.gitted", "submod2/not-submodule/.git");
+ p_rename("submod2/not/.gitted", "submod2/not/.git");
cl_fixture_cleanup("submod2_target");
@@ -954,21 +955,22 @@ void test_diff_workdir__submodules(void)
/* essentially doing: git diff 873585b94bdeabccea991ea5e3ec1a277895b698 */
memset(&exp, 0, sizeof(exp));
+
cl_git_pass(git_diff_foreach(
diff, diff_file_cb, diff_hunk_cb, diff_line_cb, &exp));
- /* the following differs from "git diff 873585" by one "untracked" file
- * because the diff list includes the "not_submodule/" directory which
- * is not displayed in the text diff.
+ /* the following differs from "git diff 873585" by two "untracked" file
+ * because the diff list includes the "not" and "not-submodule" dirs which
+ * are not displayed in the text diff.
*/
- cl_assert_equal_i(10, exp.files);
+ cl_assert_equal_i(11, exp.files);
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_IGNORED]);
- cl_assert_equal_i(9, exp.file_status[GIT_DELTA_UNTRACKED]);
+ cl_assert_equal_i(10, exp.file_status[GIT_DELTA_UNTRACKED]);
/* the following numbers match "git diff 873585" exactly */