csum-file: refactor finalize_hashfile() method
authorDerrick Stolee <dstolee@microsoft.com>
Mon, 2 Apr 2018 20:34:15 +0000 (16:34 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Apr 2018 21:27:30 +0000 (14:27 -0700)
commitcfe83216e404223ce8c5f6ef79c4ba9a27ff872e
tree6f64a9ccff4777e87bd43fdf8e051a215048ae63
parentf2af9f5e02380ba3868df7daa34368945d500206
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>
builtin/pack-objects.c
bulk-checkin.c
csum-file.c
csum-file.h
pack-bitmap-write.c
pack-write.c