pack-write: pass repository to index_pack_lockfile()

The `index_pack_lockfile()` function uses the global `the_repository`
variable to access the repository. To avoid global variable usage, pass
the repository from the layers above.

Altough the layers above could have access to the repository internally,
simply pass in `the_repository`. This avoids any compatibility issues
and bubbles up global variable usage to upper layers which can be
eventually resolved.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Karthik Nayak
2025-01-19 12:19:27 +01:00
committed by Junio C Hamano
parent 8244d01de6
commit e2f6f76585
4 changed files with 8 additions and 6 deletions

View File

@ -2304,7 +2304,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
if (status)
return "index-pack fork failed";
lockfile = index_pack_lockfile(child.out, NULL);
lockfile = index_pack_lockfile(the_repository, child.out, NULL);
if (lockfile) {
pack_lockfile = register_tempfile(lockfile);
free(lockfile);