@matheusbsbs / matheus-bagliano / commits / 3be7efcafc
Fork 0

commit-graph: define and use MAX_NUM_CHUNKS

This is a minor cleanup to make it easier to change the number of chunks being written to the commit graph. Reviewed-by: Jakub Narębski <jnareb@gmail.com> Signed-off-by: Garima Singh <garima.singh@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Garima Singh committed Mar 30, 2020 at 00:31 UTC 3be7efcafceeae3400cd830be89c9601b43f3716
1 file changed +3 -2
commit-graph.c
+3 -2
@@ -23,6 +23,7 @@
23 #define GRAPH_CHUNKID_DATA 0x43444154 /* "CDAT" */
24 #define GRAPH_CHUNKID_EXTRAEDGES 0x45444745 /* "EDGE" */
25 #define GRAPH_CHUNKID_BASE 0x42415345 /* "BASE" */
26 +#define MAX_NUM_CHUNKS 5
27
28 #define GRAPH_DATA_WIDTH (the_hash_algo->rawsz + 16)
29
@@ -1350,8 +1351,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
1351 int fd;
1352 struct hashfile *f;
1353 struct lock_file lk = LOCK_INIT;
1353 - uint32_t chunk_ids[6];
1354 - uint64_t chunk_offsets[6];
1354 + uint32_t chunk_ids[MAX_NUM_CHUNKS + 1];
1355 + uint64_t chunk_offsets[MAX_NUM_CHUNKS + 1];
1356 const unsigned hashsz = the_hash_algo->rawsz;
1357 struct strbuf progress_title = STRBUF_INIT;
1358 int num_chunks = 3;