summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-03-30 15:04:17 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-01 20:07:37 (GMT)
commit9f19161172412086f50b660a07731d636458cdc8 (patch)
treef39b2f046b4a56d4bd5dff751b814fb6f78bde97
parent7240cc4b65b6684c403487889cce396e45ad30cd (diff)
downloadgit-9f19161172412086f50b660a07731d636458cdc8.zip
git-9f19161172412086f50b660a07731d636458cdc8.tar.gz
git-9f19161172412086f50b660a07731d636458cdc8.tar.bz2
midx: keep track of the checksum
write_midx_internal() uses a hashfile to write the multi-pack index, but discards its checksum. This makes sense, since nothing that takes place after writing the MIDX cares about its checksum. That is about to change in a subsequent patch, when the optional reverse index corresponding to the MIDX will want to include the MIDX's checksum. Store the checksum of the MIDX in preparation for that. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--midx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/midx.c b/midx.c
index 25bfb33..7af5145 100644
--- a/midx.c
+++ b/midx.c
@@ -811,6 +811,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
unsigned flags)
{
char *midx_name;
+ unsigned char midx_hash[GIT_MAX_RAWSZ];
uint32_t i;
struct hashfile *f = NULL;
struct lock_file lk;
@@ -987,7 +988,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
write_midx_header(f, get_num_chunks(cf), ctx.nr - dropped_packs);
write_chunkfile(cf, &ctx);
- finalize_hashfile(f, NULL, CSUM_FSYNC | CSUM_HASH_IN_STREAM);
+ finalize_hashfile(f, midx_hash, CSUM_FSYNC | CSUM_HASH_IN_STREAM);
free_chunkfile(cf);
commit_lock_file(&lk);