fix off-by-one in got_repo_cache_pack()
diff --git a/lib/repository.c b/lib/repository.c
index 1118dce..16a7584 100644
--- a/lib/repository.c
+++ b/lib/repository.c
@@ -1102,7 +1102,7 @@ got_repo_cache_pack(struct got_pack **packp, struct got_repository *repo,
return got_error(GOT_ERR_CACHE_DUP_ENTRY);
}
- if (i == nitems(repo->packs) - 1) {
+ if (i == nitems(repo->packs)) {
err = got_pack_close(&repo->packs[i - 1]);
if (err)
return err;