Merge branch 'js/sparse-vs-split-index'
Mark in various places in the code that the sparse index and the split index features are mutually incompatible. * js/sparse-vs-split-index: split-index: it really is incompatible with the sparse index t1091: disable split index sparse-index: sparse index is disallowed when split index is activemaint
commit
1b82b936e3
|
@ -3010,6 +3010,9 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
|
|||
!is_null_oid(&istate->split_index->base_oid)) {
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
if (istate->sparse_index)
|
||||
die(_("cannot write split index for a sparse index"));
|
||||
|
||||
err = write_link_extension(&sb, istate) < 0 ||
|
||||
write_index_ext_header(f, eoie_c, CACHE_EXT_LINK,
|
||||
sb.len) < 0;
|
||||
|
|
|
@ -136,7 +136,7 @@ static int is_sparse_index_allowed(struct index_state *istate, int flags)
|
|||
/*
|
||||
* The sparse index is not (yet) integrated with a split index.
|
||||
*/
|
||||
if (istate->split_index)
|
||||
if (istate->split_index || git_env_bool("GIT_TEST_SPLIT_INDEX", 0))
|
||||
return 0;
|
||||
/*
|
||||
* The GIT_TEST_SPARSE_INDEX environment variable triggers the
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
struct split_index *init_split_index(struct index_state *istate)
|
||||
{
|
||||
if (!istate->split_index) {
|
||||
if (istate->sparse_index)
|
||||
die(_("cannot use split index with a sparse index"));
|
||||
|
||||
CALLOC_ARRAY(istate->split_index, 1);
|
||||
istate->split_index->refcount = 1;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,9 @@ test_description='sparse checkout builtin tests'
|
|||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||
|
||||
GIT_TEST_SPLIT_INDEX=false
|
||||
export GIT_TEST_SPLIT_INDEX
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
list_files() {
|
||||
|
@ -234,36 +237,31 @@ test_expect_success 'sparse-checkout disable' '
|
|||
'
|
||||
|
||||
test_expect_success 'sparse-index enabled and disabled' '
|
||||
(
|
||||
sane_unset GIT_TEST_SPLIT_INDEX &&
|
||||
git -C repo update-index --no-split-index &&
|
||||
git -C repo sparse-checkout init --cone --sparse-index &&
|
||||
test_cmp_config -C repo true index.sparse &&
|
||||
git -C repo ls-files --sparse >sparse &&
|
||||
git -C repo sparse-checkout disable &&
|
||||
git -C repo ls-files --sparse >full &&
|
||||
|
||||
git -C repo sparse-checkout init --cone --sparse-index &&
|
||||
test_cmp_config -C repo true index.sparse &&
|
||||
git -C repo ls-files --sparse >sparse &&
|
||||
git -C repo sparse-checkout disable &&
|
||||
git -C repo ls-files --sparse >full &&
|
||||
cat >expect <<-\EOF &&
|
||||
@@ -1,4 +1,7 @@
|
||||
a
|
||||
-deep/
|
||||
-folder1/
|
||||
-folder2/
|
||||
+deep/a
|
||||
+deep/deeper1/a
|
||||
+deep/deeper1/deepest/a
|
||||
+deep/deeper2/a
|
||||
+folder1/a
|
||||
+folder2/a
|
||||
EOF
|
||||
|
||||
cat >expect <<-\EOF &&
|
||||
@@ -1,4 +1,7 @@
|
||||
a
|
||||
-deep/
|
||||
-folder1/
|
||||
-folder2/
|
||||
+deep/a
|
||||
+deep/deeper1/a
|
||||
+deep/deeper1/deepest/a
|
||||
+deep/deeper2/a
|
||||
+folder1/a
|
||||
+folder2/a
|
||||
EOF
|
||||
diff -u sparse full | tail -n +3 >actual &&
|
||||
test_cmp expect actual &&
|
||||
|
||||
diff -u sparse full | tail -n +3 >actual &&
|
||||
test_cmp expect actual &&
|
||||
|
||||
git -C repo config --list >config &&
|
||||
! grep index.sparse config
|
||||
)
|
||||
git -C repo config --list >config &&
|
||||
! grep index.sparse config
|
||||
'
|
||||
|
||||
test_expect_success 'cone mode: init and set' '
|
||||
|
|
Loading…
Reference in New Issue