summaryrefslogtreecommitdiff
path: root/pack-bitmap-write.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2018-04-02 20:34:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-02 21:27:30 (GMT)
commitcfe83216e404223ce8c5f6ef79c4ba9a27ff872e (patch)
tree6f64a9ccff4777e87bd43fdf8e051a215048ae63 /pack-bitmap-write.c
parentf2af9f5e02380ba3868df7daa34368945d500206 (diff)
downloadgit-cfe83216e404223ce8c5f6ef79c4ba9a27ff872e.zip
git-cfe83216e404223ce8c5f6ef79c4ba9a27ff872e.tar.gz
git-cfe83216e404223ce8c5f6ef79c4ba9a27ff872e.tar.bz2
csum-file: refactor finalize_hashfile() method
If we want to use a hashfile on the temporary file for a lockfile, then we need finalize_hashfile() to fully write the trailing hash but also keep the file descriptor open. Do this by adding a new CSUM_HASH_IN_STREAM flag along with a functional change that checks this flag before writing the checksum to the stream. This differs from previous behavior since it would be written if either CSUM_CLOSE or CSUM_FSYNC is provided. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-bitmap-write.c')
-rw-r--r--pack-bitmap-write.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 662b44f..db4c832 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -535,7 +535,7 @@ void bitmap_writer_finish(struct pack_idx_entry **index,
if (options & BITMAP_OPT_HASH_CACHE)
write_hash_cache(f, index, index_nr);
- finalize_hashfile(f, NULL, CSUM_FSYNC);
+ finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC | CSUM_CLOSE);
if (adjust_shared_perm(tmp_file.buf))
die_errno("unable to make temporary bitmap file readable");