]> git.ipfire.org Git - thirdparty/git.git/commitdiff
split-index: it really is incompatible with the sparse index
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 19 Jan 2022 17:29:39 +0000 (17:29 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 24 Jan 2022 01:06:23 +0000 (17:06 -0800)
... 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>
read-cache.c
split-index.c

index cbe73f14e5e7efc63b20e80a2702fb5c0dea9a5d..a932e01fc7a8247520646ec6495f5020c17d95fa 100644 (file)
@@ -3009,6 +3009,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;
index 8e52e891c3bc34d35eab1124302d6f0294d9cedb..9d0ccc30d00e35965f47d55253166f3d8ce142e2 100644 (file)
@@ -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;
        }