path: root/bulk-checkin.c
diff options
authorDerrick Stolee <>2018-04-02 20:34:15 (GMT)
committerJunio C Hamano <>2018-04-02 21:27:30 (GMT)
commitcfe83216e404223ce8c5f6ef79c4ba9a27ff872e (patch)
tree6f64a9ccff4777e87bd43fdf8e051a215048ae63 /bulk-checkin.c
parentf2af9f5e02380ba3868df7daa34368945d500206 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'bulk-checkin.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/bulk-checkin.c b/bulk-checkin.c
index e8094f5..a3e1b59 100644
--- a/bulk-checkin.c
+++ b/bulk-checkin.c
@@ -35,7 +35,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
goto clear_exit;
} else if (state->nr_written == 1) {
- finalize_hashfile(state->f, oid.hash, CSUM_FSYNC);
+ finalize_hashfile(state->f, oid.hash, CSUM_HASH_IN_STREAM | CSUM_FSYNC | CSUM_CLOSE);
} else {
int fd = finalize_hashfile(state->f, oid.hash, 0);
fixup_pack_header_footer(fd, oid.hash, state->pack_tmp_name,