clean: integrate with sparse index

Remove full index requirement for `git clean` and test to ensure the index
is not expanded in `git clean`. Add to existing test for `git clean` to
verify cleanup of untracked files in sparse directories is consistent
between sparse index and non-sparse index checkouts.

Signed-off-by: Victoria Dye <vdye@github.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Victoria Dye
2022-01-11 18:05:00 +00:00
committed by Junio C Hamano
parent 1624333ec1
commit 1e9e10e048
2 changed files with 24 additions and 0 deletions

View File

@ -983,6 +983,9 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
dir.flags |= DIR_KEEP_UNTRACKED_CONTENTS;
}
prepare_repo_settings(the_repository);
the_repository->settings.command_requires_full_index = 0;
if (read_cache() < 0)
die(_("index file corrupt"));