commit - 649fc316f20c14aa1b38eeb77feacc90ab02eaa9
commit + 15fe583fb97d7e91d4cd62435189c98018f5e145
blob - d82e38e345a904ababe7f97b02142d026947c304
blob + 42722b721ec198281ab15c50078ff54bffd89521
--- lib/repository.c
+++ lib/repository.c
if (repo->packidx_cache[i] == NULL)
break;
}
-
if (i == nitems(repo->packidx_cache)) {
err = got_packidx_close(repo->packidx_cache[i - 1]);
if (err)
return err;
- memmove(&repo->packidx_cache[1], &repo->packidx_cache[0],
- sizeof(repo->packidx_cache) -
- sizeof(repo->packidx_cache[0]));
- i = 0;
}
- repo->packidx_cache[i] = packidx;
+ /*
+ * Insert the new pack index at the front so it will
+ * be searched first in the future.
+ */
+ memmove(&repo->packidx_cache[1], &repo->packidx_cache[0],
+ sizeof(repo->packidx_cache) -
+ sizeof(repo->packidx_cache[0]));
+ repo->packidx_cache[0] = packidx;
+
return NULL;
}