summaryrefslogtreecommitdiff
path: root/tests-clar/status/worktree.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/status/worktree.c')
-rw-r--r--tests-clar/status/worktree.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests-clar/status/worktree.c b/tests-clar/status/worktree.c
index b9000bb14..dbc2feebd 100644
--- a/tests-clar/status/worktree.c
+++ b/tests-clar/status/worktree.c
@@ -174,6 +174,41 @@ void test_status_worktree__swap_subdir_and_file(void)
}
+void test_status_worktree__swap_subdir_with_recurse_and_pathspec(void)
+{
+ struct status_entry_counts counts;
+ git_repository *repo = cl_git_sandbox_init("status");
+ git_status_options opts;
+
+ /* first alter the contents of the worktree */
+ cl_git_pass(p_rename("status/current_file", "status/swap"));
+ cl_git_pass(p_rename("status/subdir", "status/current_file"));
+ cl_git_pass(p_rename("status/swap", "status/subdir"));
+ cl_git_mkfile("status/.new_file", "dummy");
+ cl_git_pass(git_futils_mkdir_r("status/zzz_new_dir", NULL, 0777));
+ cl_git_mkfile("status/zzz_new_dir/new_file", "dummy");
+ cl_git_mkfile("status/zzz_new_file", "dummy");
+
+ /* now get status */
+ memset(&counts, 0x0, sizeof(struct status_entry_counts));
+ counts.expected_entry_count = entry_count4;
+ counts.expected_paths = entry_paths4;
+ counts.expected_statuses = entry_statuses4;
+
+ memset(&opts, 0, sizeof(opts));
+ opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
+ GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS;
+ /* TODO: set pathspec to "current_file" eventually */
+
+ cl_git_pass(
+ git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
+ );
+
+ cl_assert(counts.entry_count == counts.expected_entry_count);
+ cl_assert(counts.wrong_status_flags_count == 0);
+ cl_assert(counts.wrong_sorted_path == 0);
+}
+
/* this test is equivalent to t18-status.c:singlestatus0 */
void test_status_worktree__single_file(void)
{