Commit 94ef2a35 by Russell Belfer

Add test for fixed diff bug

Add test for bug fixed in 852ded96
Sorry, I wrote that bug fix and forgot to check in a test at the
same time.  Here is one that fails on the old version of the code
and now works.
parent 92808557
...@@ -1109,6 +1109,26 @@ void test_diff_workdir__untracked_directory_scenarios(void) ...@@ -1109,6 +1109,26 @@ void test_diff_workdir__untracked_directory_scenarios(void)
git_diff_list_free(diff); git_diff_list_free(diff);
/* empty directory in empty directory */
cl_git_pass(p_mkdir("status/subdir/directory/empty", 0777));
memset(&exp, 0, sizeof(exp));
exp.names = files1;
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
cl_git_pass(git_diff_foreach(diff, diff_file_cb, NULL, NULL, &exp));
cl_assert_equal_i(4, exp.files);
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
git_diff_list_free(diff);
/* directory with only ignored files */ /* directory with only ignored files */
cl_git_pass(p_mkdir("status/subdir/directory/deeper", 0777)); cl_git_pass(p_mkdir("status/subdir/directory/deeper", 0777));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment