Re: [PATCH 2/5] refs: make get_files_ref_lock_timeout_ms() repostory aware
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Mar 27, 2026, 07:50 UTC
- Message-ID
- <acY2rALGa-CdYK1J@pks.im>
- In-Reply-To
- <20260325164833.1216577-3-shreyanshpaliwalcmsmn@gmail.com>
On Wed, Mar 25, 2026 at 10:14:19PM +0530, Shreyansh Paliwal wrote:
Show 26 quoted lines
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 7ce0d57478..ee8dd771a4 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -1190,13 +1190,17 @@ static int remove_empty_directories(struct strbuf *path)
> return remove_dir_recursively(path, REMOVE_DIR_EMPTY_ONLY);
> }
>
> +struct create_reflock_cb {
> + struct lock_file *lk;
> + struct repository *repo;
> +};
> +
> static int create_reflock(const char *path, void *cb)
> {
> - struct lock_file *lk = cb;
> -
> + struct create_reflock_cb *data = cb;
> return hold_lock_file_for_update_timeout(
> - lk, path, LOCK_NO_DEREF,
> - get_files_ref_lock_timeout_ms()) < 0 ? -1 : 0;
> + data->lk, path, LOCK_NO_DEREF,
> + get_files_ref_lock_timeout_ms(data->repo)) < 0 ? -1 : 0;
> }
>
> /*Makes sense. This function is used as a callback to `raceproof_create_file()`, and that callsite is adapted accordingly to pass the new struct as payload.
Patrick