diff --git a/.github/workflows/scalar-functional-tests.yml b/.github/workflows/scalar-functional-tests.yml index 438933d6aed2a3..60f9603d0a6dab 100644 --- a/.github/workflows/scalar-functional-tests.yml +++ b/.github/workflows/scalar-functional-tests.yml @@ -37,6 +37,7 @@ jobs: env: BUILD_FRAGMENT: bin/Release/netcoreapp3.1 + GIT_TEST_FAIL_ENSURE_FULL_INDEX: 1 steps: - name: Check out Git's source code diff --git a/sparse-index.c b/sparse-index.c index 218eb0938a24de..db4dd80bdaed7c 100644 --- a/sparse-index.c +++ b/sparse-index.c @@ -251,6 +251,16 @@ void ensure_full_index(struct index_state *istate) if (!istate->repo) istate->repo = the_repository; + if (!istate->repo->settings.command_requires_full_index) { + static int fail_on_expand = -1; + + if (fail_on_expand < 0) + fail_on_expand = git_env_bool("GIT_TEST_FAIL_ENSURE_FULL_INDEX", 0); + + if (fail_on_expand) + die("sparse index will expand in an integrated command"); + } + trace2_region_enter("index", "ensure_full_index", istate->repo); /* initialize basics of new index */