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>
Martin Ågren committed
Jan 5, 2021 at 20:23 UTC
a52cdce936fe473429bd4354079f03c3fb0234e9
1 file changed
+3
-3
commit-graph.c
+3
-3
@@ -1694,8 +1694,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
1694
} else {
1695
hold_lock_file_for_update_mode(&lk, ctx->graph_name,
1696
LOCK_DIE_ON_ERROR, 0444);
1697
- fd = lk.tempfile->fd;
1698
- f = hashfd(lk.tempfile->fd, lk.tempfile->filename.buf);
1697
+ fd = get_lock_file_fd(&lk);
1698
+ f = hashfd(fd, get_lock_file_path(&lk));
1699
}
1700
1701
chunks[0].id = GRAPH_CHUNKID_OIDFANOUT;
@@ -1833,7 +1833,7 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
1833
result = rename(ctx->graph_name, final_graph_name);
1834
1835
for (i = 0; i < ctx->num_commit_graphs_after; i++)
1836
- fprintf(lk.tempfile->fp, "%s\n", ctx->commit_graph_hash_after[i]);
1836
+ fprintf(get_lock_file_fp(&lk), "%s\n", ctx->commit_graph_hash_after[i]);
1837
1838
if (result) {
1839
error(_("failed to rename temporary commit-graph file"));