diff options
author | Martin Ågren <martin.agren@gmail.com> | 2021-01-05 20:23:48 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-06 13:53:32 -0800 |
commit | acd7160201ae908d3e0fccee19685ab19b1be720 (patch) | |
tree | 0ba4fe142d46ac09fe66dabbb0f914f450b857da /midx.c | |
parent | commit-graph: don't peek into `struct lock_file` (diff) | |
download | tgif-acd7160201ae908d3e0fccee19685ab19b1be720.tar.xz |
midx: don't peek into `struct lock_file`
Similar to the previous commits, avoid peeking into the `struct
lock_file`. Use the lock file API instead.
The two functions we're calling here double-check that the tempfile is
indeed "active", which is arguably overkill considering how we took the
lock on the line immediately above. More importantly, this future-proofs
us against, e.g., other code appearing between these two lines or the
lock file and/or tempfile internals changing.
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>
Diffstat (limited to 'midx.c')
-rw-r--r-- | midx.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -918,7 +918,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index * (pack_name_concat_len % MIDX_CHUNK_ALIGNMENT); hold_lock_file_for_update(&lk, midx_name, LOCK_DIE_ON_ERROR); - f = hashfd(lk.tempfile->fd, lk.tempfile->filename.buf); + f = hashfd(get_lock_file_fd(&lk), get_lock_file_path(&lk)); FREE_AND_NULL(midx_name); if (packs.m) |