split-index: it really is incompatible with the sparse index
... at least for now. So let's error out if we are even trying to initialize the split index when the index is sparse, or when trying to write the split index extension for a sparse index. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Jan 19, 2022 at 17:29 UTC
451b66c533b9ede47951d16c0127ab33372125ca
2 files changed
+6
read-cache.c
+3
@@ -3009,6 +3009,9 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
3009
!is_null_oid(&istate->split_index->base_oid)) {
3010
struct strbuf sb = STRBUF_INIT;
3011
3012
+ if (istate->sparse_index)
3013
+ die(_("cannot write split index for a sparse index"));
3014
+
3015
err = write_link_extension(&sb, istate) < 0 ||
3016
write_index_ext_header(f, eoie_c, CACHE_EXT_LINK,
3017
sb.len) < 0;
split-index.c
+3
@@ -5,6 +5,9 @@
5
struct split_index *init_split_index(struct index_state *istate)
6
{
7
if (!istate->split_index) {
8
+ if (istate->sparse_index)
9
+ die(_("cannot use split index with a sparse index"));
10
+
11
CALLOC_ARRAY(istate->split_index, 1);
12
istate->split_index->refcount = 1;
13
}