@@ -526,6 +526,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
add_new_files = !take_worktree_changes && !refresh_only && !add_renormalize;
require_pathspec = !(take_worktree_changes || (0 < addremove_explicit));
+ prepare_repo_settings(the_repository);
+ the_repository->settings.command_requires_full_index = 0;
+
hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
/*
@@ -459,6 +459,18 @@ test_expect_success 'sparse-index is not expanded' '
echo >>sparse-index/untracked.txt &&
GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
git -C sparse-index status &&
+ test_region ! index ensure_full_index trace2.txt &&
+
+ rm trace2.txt &&
+ echo >>sparse-index/README.md &&
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
+ git -C sparse-index add -A &&
+ test_region ! index ensure_full_index trace2.txt &&
+
+ rm trace2.txt &&
+ echo >>sparse-index/extra.txt &&
+ GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
+ git -C sparse-index add extra.txt &&
test_region ! index ensure_full_index trace2.txt
'