}
/* remember to discard_cache() before reading a different cache! */
-static int do_read_index(struct index_state *istate, const char *path,
- int must_exist)
+int do_read_index(struct index_state *istate, const char *path, int must_exist)
{
int fd, i;
struct stat st;
}
}
- if (!istate->version)
+ if (!istate->version) {
istate->version = get_index_format_default();
+ if (getenv("GIT_TEST_SPLIT_INDEX"))
+ init_split_index(istate);
+ }
/* demote version 3 to version 2 when the latter suffices */
if (istate->version == 3 || istate->version == 2)
{
struct split_index *si = istate->split_index;
- if (!si || (istate->cache_changed & ~EXTMASK)) {
+ if (!si || alternate_index_output ||
+ (istate->cache_changed & ~EXTMASK)) {
if (si)
hashclr(si->base_sha1);
return do_write_locked_index(istate, lock, flags);
}
+ if (getenv("GIT_TEST_SPLIT_INDEX")) {
+ int v = si->base_sha1[0];
+ if ((v & 15) < 6)
+ istate->cache_changed |= SPLIT_INDEX_ORDERED;
+ }
if (istate->cache_changed & SPLIT_INDEX_ORDERED) {
int ret = write_shared_index(istate, lock, flags);
if (ret)