diff --git a/builtin/diff.c b/builtin/diff.c index dd8ce688ba7054..a02c5b8ed95021 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -436,6 +436,9 @@ int cmd_diff(int argc, const char **argv, const char *prefix) } prefix = setup_git_directory_gently(&nongit); + + prepare_repo_settings(the_repository); + the_repository->settings.command_requires_full_index = 0; if (!no_index) { /* diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index 0dfffb8856f466..4a3e7eecc28f4e 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -693,6 +693,11 @@ test_expect_success 'sparse-index is not expanded' ' echo >>sparse-index/untracked.txt && ensure_not_expanded add . && + echo "a test change" >> sparse-index/README.md && + ensure_not_expanded diff && + git -C sparse-index add README.md && + ensure_not_expanded diff --staged && + ensure_not_expanded checkout -f update-deep && ( sane_unset GIT_TEST_MERGE_ALGORITHM &&