diff options
| author | Karthik Nayak <karthik.188@gmail.com> | 2024-12-03 15:43:59 +0100 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-12-04 08:21:54 +0900 |
| commit | cc656f4eb2b7b10bc530c96844909c869bdd1fdf (patch) | |
| tree | 24a6ddb8fa0fde090ead24c5b7961faa453b3803 /packfile.c | |
| parent | packfile: pass down repository to `odb_pack_name` (diff) | |
| download | git-cc656f4eb2b7b10bc530c96844909c869bdd1fdf.tar.gz git-cc656f4eb2b7b10bc530c96844909c869bdd1fdf.zip | |
packfile: pass down repository to `has_object[_kept]_pack`
The functions `has_object[_kept]_pack` currently rely 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. Let's remove its usage from these
functions and any related ones.
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.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/packfile.c b/packfile.c index 1015dac6db..e7dd270217 100644 --- a/packfile.c +++ b/packfile.c @@ -2143,16 +2143,17 @@ int find_kept_pack_entry(struct repository *r, return 0; } -int has_object_pack(const struct object_id *oid) +int has_object_pack(struct repository *r, const struct object_id *oid) { struct pack_entry e; - return find_pack_entry(the_repository, oid, &e); + return find_pack_entry(r, oid, &e); } -int has_object_kept_pack(const struct object_id *oid, unsigned flags) +int has_object_kept_pack(struct repository *r, const struct object_id *oid, + unsigned flags) { struct pack_entry e; - return find_kept_pack_entry(the_repository, oid, flags, &e); + return find_kept_pack_entry(r, oid, flags, &e); } int for_each_object_in_pack(struct packed_git *p, |
