Skip to content

Commit 451b66c

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ac873c2 commit 451b66c

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

read-cache.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3009,6 +3009,9 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
30093009
!is_null_oid(&istate->split_index->base_oid)) {
30103010
struct strbuf sb = STRBUF_INIT;
30113011

3012+
if (istate->sparse_index)
3013+
die(_("cannot write split index for a sparse index"));
3014+
30123015
err = write_link_extension(&sb, istate) < 0 ||
30133016
write_index_ext_header(f, eoie_c, CACHE_EXT_LINK,
30143017
sb.len) < 0;

split-index.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
struct split_index *init_split_index(struct index_state *istate)
66
{
77
if (!istate->split_index) {
8+
if (istate->sparse_index)
9+
die(_("cannot use split index with a sparse index"));
10+
811
CALLOC_ARRAY(istate->split_index, 1);
912
istate->split_index->refcount = 1;
1013
}

0 commit comments

Comments
 (0)