summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Martin Ågren <martin.agren@gmail.com>2021-01-05 20:23:47 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-01-06 13:53:32 -0800
commita52cdce936fe473429bd4354079f03c3fb0234e9 (patch)
treedfb7e99670be27b5e2f8b3209d744ce1e3647ba8
parentbuiltin/gc: don't peek into `struct lock_file` (diff)
downloadtgif-a52cdce936fe473429bd4354079f03c3fb0234e9.tar.xz
commit-graph: don't peek into `struct lock_file`
Similar to the previous commit, avoid peeking into the `struct lock_file`. Use the lock file API instead. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Reviewed-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--commit-graph.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/commit-graph.c b/commit-graph.c
index 06f8dc1d89..031641014f 100644
--- a/commit-graph.c
+++ b/commit-graph.c
@@ -1694,8 +1694,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
} else {
hold_lock_file_for_update_mode(&lk, ctx->graph_name,
LOCK_DIE_ON_ERROR, 0444);
- fd = lk.tempfile->fd;
- f = hashfd(lk.tempfile->fd, lk.tempfile->filename.buf);
+ fd = get_lock_file_fd(&lk);
+ f = hashfd(fd, get_lock_file_path(&lk));
}
chunks[0].id = GRAPH_CHUNKID_OIDFANOUT;
@@ -1833,7 +1833,7 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
result = rename(ctx->graph_name, final_graph_name);
for (i = 0; i < ctx->num_commit_graphs_after; i++)
- fprintf(lk.tempfile->fp, "%s\n", ctx->commit_graph_hash_after[i]);
+ fprintf(get_lock_file_fp(&lk), "%s\n", ctx->commit_graph_hash_after[i]);
if (result) {
error(_("failed to rename temporary commit-graph file"));