split-index: BUG() when cache entry refers to non-existing shared entry
[gitweb.git] / split-index.c
index 875f53880231b93c0e41bfbf625dd605a8196477..5820412dc5203032d1247575d79c6107a163295a 100644 (file)
@@ -254,8 +254,8 @@ void prepare_to_write_split_index(struct index_state *istate)
                                continue;
                        }
                        if (ce->index > si->base->cache_nr) {
-                               ce->index = 0;
-                               continue;
+                               BUG("ce refers to a shared ce at %d, which is beyond the shared index size %d",
+                                   ce->index, si->base->cache_nr);
                        }
                        ce->ce_flags |= CE_MATCHED; /* or "shared" */
                        base = si->base->cache[ce->index - 1];