The `MIDX_MIN_SIZE` definition is used to check the midx_size in
`local_multi_pack_index_one`. This definition relies on the
`the_hash_algo` global variable. Inline this and remove the global
variable usage.
With this, remove `USE_THE_REPOSITORY_VARIABLE` usage from `midx.c`.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-#define USE_THE_REPOSITORY_VARIABLE
-
#include "git-compat-util.h"
#include "config.h"
#include "dir.h"
return 0;
}
-#define MIDX_MIN_SIZE (MIDX_HEADER_SIZE + the_hash_algo->rawsz)
-
static struct multi_pack_index *load_multi_pack_index_one(struct repository *r,
const char *object_dir,
const char *midx_name,
midx_size = xsize_t(st.st_size);
- if (midx_size < MIDX_MIN_SIZE) {
+ if (midx_size < (MIDX_HEADER_SIZE + r->hash_algo->rawsz)) {
error(_("multi-pack-index file %s is too small"), midx_name);
goto cleanup_fail;
}