Merge branch 'rs/tempfile-wo-the-repository'

The tempfile and lockfile APIs have been refactored to stop depending
on the 'the_repository' global variable, and their callers have been
updated to use the repository-aware variants.

* rs/tempfile-wo-the-repository:
  use repo_hold_lock_file_for_update{,_mode,_timeout}() with custom repos
  tempfile: stop using the_repository
  lockfile: add repo_hold_lock_file_for_update{,_timeout}{,_mode}()
  refs/packed: use repo_create_tempfile()
  tempfile: add repo_create_tempfile{,_mode}()
This commit is contained in:
Junio C Hamano
2026-07-30 10:32:02 -07:00
21 changed files with 110 additions and 52 deletions

View File

@@ -2127,8 +2127,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
if (ctx->split) {
char *lock_name = get_commit_graph_chain_filename(ctx->odb_source);
hold_lock_file_for_update_mode(&lk, lock_name,
LOCK_DIE_ON_ERROR, 0444);
repo_hold_lock_file_for_update_mode(ctx->r, &lk, lock_name,
LOCK_DIE_ON_ERROR, 0444);
free(lock_name);
graph_layer = mks_tempfile_m(ctx->graph_name, 0444);
@@ -2146,8 +2146,9 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
f = hashfd(ctx->r->hash_algo,
get_tempfile_fd(graph_layer), get_tempfile_path(graph_layer));
} else {
hold_lock_file_for_update_mode(&lk, ctx->graph_name,
LOCK_DIE_ON_ERROR, 0444);
repo_hold_lock_file_for_update_mode(ctx->r, &lk,
ctx->graph_name,
LOCK_DIE_ON_ERROR, 0444);
f = hashfd(ctx->r->hash_algo,
get_lock_file_fd(&lk), get_lock_file_path(&lk));
}