Skip to content

Commit 9f19161

Browse files
ttaylorrgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7240cc4 commit 9f19161

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

midx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
811811
unsigned flags)
812812
{
813813
char *midx_name;
814+
unsigned char midx_hash[GIT_MAX_RAWSZ];
814815
uint32_t i;
815816
struct hashfile *f = NULL;
816817
struct lock_file lk;
@@ -987,7 +988,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
987988
write_midx_header(f, get_num_chunks(cf), ctx.nr - dropped_packs);
988989
write_chunkfile(cf, &ctx);
989990

990-
finalize_hashfile(f, NULL, CSUM_FSYNC | CSUM_HASH_IN_STREAM);
991+
finalize_hashfile(f, midx_hash, CSUM_FSYNC | CSUM_HASH_IN_STREAM);
991992
free_chunkfile(cf);
992993
commit_lock_file(&lk);
993994

0 commit comments

Comments
 (0)