]> git.ipfire.org Git - thirdparty/git.git/commit
refs: add struct repository parameter in get_files_ref_lock_timeout_ms()
authorShreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Sat, 4 Apr 2026 13:58:38 +0000 (19:28 +0530)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Apr 2026 16:58:09 +0000 (09:58 -0700)
commitb886f0b5dc71030bc9dcf58376533cf8e1098e9a
tree4793c0695068779a319c94513c26113990549f5f
parent2b39a27d40682c09ac1c031f099ee602061597cd
refs: add struct repository parameter in get_files_ref_lock_timeout_ms()

get_files_ref_lock_timeout_ms() calls repo_config_get_int() using
the_repository, as no repository instance is available in its scope. Add a
struct repository parameter and use it instead of the_repository.

Update all callers accordingly. In files-backend.c, lock_raw_ref() can
obtain repository instance from the struct ref_transaction via
transaction->ref_store->repo and pass it down. For create_reflock(), which
is used as a callback, introduce a small wrapper struct to pass both struct
lock_file and struct repository through the callback data.

This reduces reliance on the_repository global, though the function
still uses static variables and is not yet fully repository-scoped.
This can be addressed in a follow-up change.

Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c
refs/files-backend.c
refs/refs-internal.h