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'
This commit is contained in:
@@ -924,6 +924,11 @@ static int sparse_checkout_disable(int argc, const char **argv,
|
|||||||
builtin_sparse_checkout_disable_options,
|
builtin_sparse_checkout_disable_options,
|
||||||
builtin_sparse_checkout_disable_usage, 0);
|
builtin_sparse_checkout_disable_usage, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable the advice message for expanding a sparse index, as we
|
||||||
|
* are expecting to do that when disabling sparse-checkout.
|
||||||
|
*/
|
||||||
|
give_advice_on_expansion = 0;
|
||||||
repo_read_index(the_repository);
|
repo_read_index(the_repository);
|
||||||
|
|
||||||
memset(&pl, 0, sizeof(pl));
|
memset(&pl, 0, sizeof(pl));
|
||||||
|
|||||||
@@ -21,9 +21,10 @@
|
|||||||
* advice for advice.sparseIndexExpanded when expanding a sparse index to a full
|
* advice for advice.sparseIndexExpanded when expanding a sparse index to a full
|
||||||
* one. However, this is sometimes done on purpose, such as in the sparse-checkout
|
* one. However, this is sometimes done on purpose, such as in the sparse-checkout
|
||||||
* builtin, even when index.sparse=false. This may be disabled in
|
* builtin, even when index.sparse=false. This may be disabled in
|
||||||
* convert_to_sparse().
|
* convert_to_sparse() or by commands that know they will lead to a full
|
||||||
|
* expansion, but this message is not actionable.
|
||||||
*/
|
*/
|
||||||
static int give_advice_on_expansion = 1;
|
int give_advice_on_expansion = 1;
|
||||||
#define ADVICE_MSG \
|
#define ADVICE_MSG \
|
||||||
"The sparse index is expanding to a full index, a slow operation.\n" \
|
"The sparse index is expanding to a full index, a slow operation.\n" \
|
||||||
"Your working directory likely has contents that are outside of\n" \
|
"Your working directory likely has contents that are outside of\n" \
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
#ifndef SPARSE_INDEX_H__
|
#ifndef SPARSE_INDEX_H__
|
||||||
#define SPARSE_INDEX_H__
|
#define SPARSE_INDEX_H__
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If performing an operation where the index is supposed to expand to a
|
||||||
|
* full index, then disable the advice message by setting this global to
|
||||||
|
* zero.
|
||||||
|
*/
|
||||||
|
extern int give_advice_on_expansion;
|
||||||
|
|
||||||
struct index_state;
|
struct index_state;
|
||||||
#define SPARSE_INDEX_MEMORY_ONLY (1 << 0)
|
#define SPARSE_INDEX_MEMORY_ONLY (1 << 0)
|
||||||
int is_sparse_index_allowed(struct index_state *istate, int flags);
|
int is_sparse_index_allowed(struct index_state *istate, int flags);
|
||||||
|
|||||||
@@ -2355,7 +2355,10 @@ test_expect_success 'advice.sparseIndexExpanded' '
|
|||||||
mkdir -p sparse-index/deep/deeper2/deepest &&
|
mkdir -p sparse-index/deep/deeper2/deepest &&
|
||||||
touch sparse-index/deep/deeper2/deepest/bogus &&
|
touch sparse-index/deep/deeper2/deepest/bogus &&
|
||||||
git -C sparse-index status 2>err &&
|
git -C sparse-index status 2>err &&
|
||||||
grep "The sparse index is expanding to a full index" err
|
grep "The sparse index is expanding to a full index" err &&
|
||||||
|
|
||||||
|
git -C sparse-index sparse-checkout disable 2>err &&
|
||||||
|
test_line_count = 0 err
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'cat-file -p' '
|
test_expect_success 'cat-file -p' '
|
||||||
|
|||||||
Reference in New Issue
Block a user