aboutsummaryrefslogtreecommitdiff
path: root/midx.h
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-11-27 17:28:32 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-04 10:32:21 +0900
commitf59de71cf700f9f8da27023ec8b5df117f99d9c8 (patch)
treed6fea036d096b6b92fb763df8697fb24f383d9f9 /midx.h
parentd5c2ca576a47480b03a83821041955a21a645d1a (diff)
downloadgit-f59de71cf700f9f8da27023ec8b5df117f99d9c8.tar.xz
midx: pass down `hash_algo` to functions using global variables
The functions `get_split_midx_filename_ext()`, `get_midx_filename()` and `get_midx_filename_ext()` use `hash_to_hex()` which internally uses the `the_hash_algo` global variable. Remove this dependency on global variables by passing down the `hash_algo` through to the functions mentioned and instead calling `hash_to_hex_algop()` along with the obtained `hash_algo`. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'midx.h')
-rw-r--r--midx.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/midx.h b/midx.h
index 78efa28d35..9d1374cbd5 100644
--- a/midx.h
+++ b/midx.h
@@ -7,6 +7,7 @@ struct object_id;
struct pack_entry;
struct repository;
struct bitmapped_pack;
+struct git_hash_algo;
#define MIDX_SIGNATURE 0x4d494458 /* "MIDX" */
#define MIDX_VERSION 1
@@ -89,12 +90,15 @@ struct multi_pack_index {
#define MIDX_EXT_MIDX "midx"
const unsigned char *get_midx_checksum(struct multi_pack_index *m);
-void get_midx_filename(struct strbuf *out, const char *object_dir);
-void get_midx_filename_ext(struct strbuf *out, const char *object_dir,
+void get_midx_filename(const struct git_hash_algo *hash_algo,
+ struct strbuf *out, const char *object_dir);
+void get_midx_filename_ext(const struct git_hash_algo *hash_algo,
+ struct strbuf *out, const char *object_dir,
const unsigned char *hash, const char *ext);
void get_midx_chain_dirname(struct strbuf *buf, const char *object_dir);
void get_midx_chain_filename(struct strbuf *buf, const char *object_dir);
-void get_split_midx_filename_ext(struct strbuf *buf, const char *object_dir,
+void get_split_midx_filename_ext(const struct git_hash_algo *hash_algo,
+ struct strbuf *buf, const char *object_dir,
const unsigned char *hash, const char *ext);
struct multi_pack_index *load_multi_pack_index(struct repository *r,