Git fork

Merge branch 'ds/sparse-checkout-expansion-advice'

When "git sparse-checkout disable" turns a sparse checkout into a
regular checkout, the index is fully expanded. This totally
expected behaviour however had an "oops, we are expanding the
index" advice message, which has been corrected.

* ds/sparse-checkout-expansion-advice:
sparse-checkout: disable advice in 'disable'

+19 -3
+5
builtin/sparse-checkout.c
··· 924 924 builtin_sparse_checkout_disable_options, 925 925 builtin_sparse_checkout_disable_usage, 0); 926 926 927 + /* 928 + * Disable the advice message for expanding a sparse index, as we 929 + * are expecting to do that when disabling sparse-checkout. 930 + */ 931 + give_advice_on_expansion = 0; 927 932 repo_read_index(the_repository); 928 933 929 934 memset(&pl, 0, sizeof(pl));
+3 -2
sparse-index.c
··· 21 21 * advice for advice.sparseIndexExpanded when expanding a sparse index to a full 22 22 * one. However, this is sometimes done on purpose, such as in the sparse-checkout 23 23 * builtin, even when index.sparse=false. This may be disabled in 24 - * convert_to_sparse(). 24 + * convert_to_sparse() or by commands that know they will lead to a full 25 + * expansion, but this message is not actionable. 25 26 */ 26 - static int give_advice_on_expansion = 1; 27 + int give_advice_on_expansion = 1; 27 28 #define ADVICE_MSG \ 28 29 "The sparse index is expanding to a full index, a slow operation.\n" \ 29 30 "Your working directory likely has contents that are outside of\n" \
+7
sparse-index.h
··· 1 1 #ifndef SPARSE_INDEX_H__ 2 2 #define SPARSE_INDEX_H__ 3 3 4 + /* 5 + * If performing an operation where the index is supposed to expand to a 6 + * full index, then disable the advice message by setting this global to 7 + * zero. 8 + */ 9 + extern int give_advice_on_expansion; 10 + 4 11 struct index_state; 5 12 #define SPARSE_INDEX_MEMORY_ONLY (1 << 0) 6 13 int is_sparse_index_allowed(struct index_state *istate, int flags);
+4 -1
t/t1092-sparse-checkout-compatibility.sh
··· 2355 2355 mkdir -p sparse-index/deep/deeper2/deepest && 2356 2356 touch sparse-index/deep/deeper2/deepest/bogus && 2357 2357 git -C sparse-index status 2>err && 2358 - grep "The sparse index is expanding to a full index" err 2358 + grep "The sparse index is expanding to a full index" err && 2359 + 2360 + git -C sparse-index sparse-checkout disable 2>err && 2361 + test_line_count = 0 err 2359 2362 ' 2360 2363 2361 2364 test_expect_success 'cat-file -p' '