mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-07 23:19:28 +00:00
Restore default status recursion behavior
This gives `git_status_foreach()` back its old behavior of emulating the "--untracked=all" behavior of git. You can get any of the various --untracked options by passing flags to `git_status_foreach_ext()` but the basic version will keep the behavior it has always had.
This commit is contained in:
parent
4b136a94d9
commit
c8838ee92d
@ -192,7 +192,8 @@ int git_status_foreach(
|
|||||||
|
|
||||||
opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
opts.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR;
|
||||||
opts.flags = GIT_STATUS_OPT_INCLUDE_IGNORED |
|
opts.flags = GIT_STATUS_OPT_INCLUDE_IGNORED |
|
||||||
GIT_STATUS_OPT_INCLUDE_UNTRACKED;
|
GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
||||||
|
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS;
|
||||||
|
|
||||||
return git_status_foreach_ext(repo, &opts, callback, payload);
|
return git_status_foreach_ext(repo, &opts, callback, payload);
|
||||||
}
|
}
|
||||||
|
@ -143,11 +143,12 @@ void test_status_worktree__purged_worktree(void)
|
|||||||
cl_assert(counts.wrong_sorted_path == 0);
|
cl_assert(counts.wrong_sorted_path == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this test is equivalent to t18-status.c:statuscb3 */
|
/* this test is similar to t18-status.c:statuscb3 */
|
||||||
void test_status_worktree__swap_subdir_and_file(void)
|
void test_status_worktree__swap_subdir_and_file(void)
|
||||||
{
|
{
|
||||||
struct status_entry_counts counts;
|
struct status_entry_counts counts;
|
||||||
git_repository *repo = cl_git_sandbox_init("status");
|
git_repository *repo = cl_git_sandbox_init("status");
|
||||||
|
git_status_options opts;
|
||||||
|
|
||||||
/* first alter the contents of the worktree */
|
/* first alter the contents of the worktree */
|
||||||
cl_git_pass(p_rename("status/current_file", "status/swap"));
|
cl_git_pass(p_rename("status/current_file", "status/swap"));
|
||||||
@ -164,8 +165,12 @@ void test_status_worktree__swap_subdir_and_file(void)
|
|||||||
counts.expected_paths = entry_paths3;
|
counts.expected_paths = entry_paths3;
|
||||||
counts.expected_statuses = entry_statuses3;
|
counts.expected_statuses = entry_statuses3;
|
||||||
|
|
||||||
|
memset(&opts, 0, sizeof(opts));
|
||||||
|
opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
||||||
|
GIT_STATUS_OPT_INCLUDE_IGNORED;
|
||||||
|
|
||||||
cl_git_pass(
|
cl_git_pass(
|
||||||
git_status_foreach(repo, cb_status__normal, &counts)
|
git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
|
||||||
);
|
);
|
||||||
|
|
||||||
cl_assert(counts.entry_count == counts.expected_entry_count);
|
cl_assert(counts.entry_count == counts.expected_entry_count);
|
||||||
|
@ -261,7 +261,9 @@ static const char *entry_paths3[] = {
|
|||||||
"42-is-not-prime.sigh",
|
"42-is-not-prime.sigh",
|
||||||
"README.md",
|
"README.md",
|
||||||
"current_file",
|
"current_file",
|
||||||
"current_file/",
|
"current_file/current_file",
|
||||||
|
"current_file/modified_file",
|
||||||
|
"current_file/new_file",
|
||||||
"file_deleted",
|
"file_deleted",
|
||||||
"ignored_file",
|
"ignored_file",
|
||||||
"modified_file",
|
"modified_file",
|
||||||
@ -286,6 +288,8 @@ static const unsigned int entry_statuses3[] = {
|
|||||||
GIT_STATUS_WT_NEW,
|
GIT_STATUS_WT_NEW,
|
||||||
GIT_STATUS_WT_DELETED,
|
GIT_STATUS_WT_DELETED,
|
||||||
GIT_STATUS_WT_NEW,
|
GIT_STATUS_WT_NEW,
|
||||||
|
GIT_STATUS_WT_NEW,
|
||||||
|
GIT_STATUS_WT_NEW,
|
||||||
GIT_STATUS_WT_DELETED,
|
GIT_STATUS_WT_DELETED,
|
||||||
GIT_STATUS_IGNORED,
|
GIT_STATUS_IGNORED,
|
||||||
GIT_STATUS_WT_MODIFIED,
|
GIT_STATUS_WT_MODIFIED,
|
||||||
@ -304,7 +308,7 @@ static const unsigned int entry_statuses3[] = {
|
|||||||
GIT_STATUS_WT_DELETED,
|
GIT_STATUS_WT_DELETED,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ENTRY_COUNT3 21
|
#define ENTRY_COUNT3 23
|
||||||
|
|
||||||
BEGIN_TEST(statuscb3, "test retrieving status for a worktree where a file and a subdir have been renamed and some files have been added")
|
BEGIN_TEST(statuscb3, "test retrieving status for a worktree where a file and a subdir have been renamed and some files have been added")
|
||||||
git_repository *repo;
|
git_repository *repo;
|
||||||
|
Loading…
Reference in New Issue
Block a user