aboutsummaryrefslogtreecommitdiff
path: root/packfile.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2024-12-03 15:43:58 +0100
committerJunio C Hamano <gitster@pobox.com>2024-12-04 08:21:54 +0900
commit873b00597bbf20c1bcda089a687641167b148fa2 (patch)
tree24fa801860fbbc927e83474a37d2fae858da0f99 /packfile.c
parent4f9e6bd4923728053669c300d3ee8483d95f599b (diff)
downloadgit-873b00597bbf20c1bcda089a687641167b148fa2.tar.xz
packfile: pass down repository to `odb_pack_name`
The function `odb_pack_name` currently relies on the global variable `the_repository`. To eliminate global variable usage in `packfile.c`, we should progressively shift the dependency on the_repository to higher layers. Signed-off-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'packfile.c')
-rw-r--r--packfile.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/packfile.c b/packfile.c
index c96ebc4c69..1015dac6db 100644
--- a/packfile.c
+++ b/packfile.c
@@ -25,13 +25,12 @@
#include "pack-revindex.h"
#include "promisor-remote.h"
-char *odb_pack_name(struct strbuf *buf,
- const unsigned char *hash,
- const char *ext)
+char *odb_pack_name(struct repository *r, struct strbuf *buf,
+ const unsigned char *hash, const char *ext)
{
strbuf_reset(buf);
- strbuf_addf(buf, "%s/pack/pack-%s.%s", repo_get_object_directory(the_repository),
- hash_to_hex(hash), ext);
+ strbuf_addf(buf, "%s/pack/pack-%s.%s", repo_get_object_directory(r),
+ hash_to_hex_algop(hash, r->hash_algo), ext);
return buf->buf;
}