Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94ef2a3

Browse files
committed
Add test for fixed diff bug
Add test for bug fixed in 852ded9 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.
1 parent 9280855 commit 94ef2a3

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests-clar/diff/workdir.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,26 @@ void test_diff_workdir__untracked_directory_scenarios(void)
11091109

11101110
git_diff_list_free(diff);
11111111

1112+
/* empty directory in empty directory */
1113+
1114+
cl_git_pass(p_mkdir("status/subdir/directory/empty", 0777));
1115+
1116+
memset(&exp, 0, sizeof(exp));
1117+
exp.names = files1;
1118+
1119+
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
1120+
1121+
cl_git_pass(git_diff_foreach(diff, diff_file_cb, NULL, NULL, &exp));
1122+
1123+
cl_assert_equal_i(4, exp.files);
1124+
cl_assert_equal_i(0, exp.file_status[GIT_DELTA_ADDED]);
1125+
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_DELETED]);
1126+
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_MODIFIED]);
1127+
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_IGNORED]);
1128+
cl_assert_equal_i(1, exp.file_status[GIT_DELTA_UNTRACKED]);
1129+
1130+
git_diff_list_free(diff);
1131+
11121132
/* directory with only ignored files */
11131133

11141134
cl_git_pass(p_mkdir("status/subdir/directory/deeper", 0777));

0 commit comments

Comments
 (0)