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

Skip to content

Commit 8cc723c

Browse files
committed
Add 2 failing tests related to '.' handling
No files matched. It fails in `workdir_iterator__update_entry`, as it thinks there is a "." (respectively "./subdir") prefix. I don't understand iterators well enough to propose a correct fix for now (if there needs one). So far, here is what I thought of: - Should we "compact" the passed pathspecs, in order to remove the "." and ".."? - Should we have a custom `prefixcomp` function for iterators, that handles "." and ".." differently?
1 parent 94c7afb commit 8cc723c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests-clar/diff/notify.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,46 @@ void test_diff_notify__notify_catchall(void)
154154
test_notify(searched_pathspecs, 1, expected_matched_pathspecs, 13);
155155
}
156156

157+
/*void test_diff_notify__notify_catchall3(void)
158+
{
159+
char *searched_pathspecs[] = {
160+
"./subdir",
161+
};
162+
notify_expected expected_matched_pathspecs[] = {
163+
{ "subdir/deleted_file", "./subdir" },
164+
{ "subdir/modified_file", "./subdir" },
165+
{ "subdir/new_file", "./subdir" },
166+
{ NULL, NULL }
167+
};
168+
169+
test_notify(searched_pathspecs, 1, expected_matched_pathspecs, 3);
170+
}
171+
172+
void test_diff_notify__notify_catchall2(void)
173+
{
174+
char *searched_pathspecs[] = {
175+
".",
176+
};
177+
notify_expected expected_matched_pathspecs[] = {
178+
{ "file_deleted", "." },
179+
{ "ignored_file", "." },
180+
{ "modified_file", "." },
181+
{ "new_file", "." },
182+
{ "\xe8\xbf\x99", "." },
183+
{ "staged_changes_file_deleted", "." },
184+
{ "staged_changes_modified_file", "." },
185+
{ "staged_delete_modified_file", "." },
186+
{ "staged_new_file_deleted_file", "." },
187+
{ "staged_new_file_modified_file", "." },
188+
{ "subdir/deleted_file", "." },
189+
{ "subdir/modified_file", "." },
190+
{ "subdir/new_file", "." },
191+
{ NULL, NULL }
192+
};
193+
194+
test_notify(searched_pathspecs, 1, expected_matched_pathspecs, 13);
195+
}*/
196+
157197
static int abort_diff(
158198
const git_diff_list *diff_so_far,
159199
const git_diff_delta *delta_to_add,

0 commit comments

Comments
 (0)