]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-graph: define and use MAX_NUM_CHUNKS
authorGarima Singh <garima.singh@microsoft.com>
Mon, 30 Mar 2020 00:31:23 +0000 (00:31 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2020 16:59:52 +0000 (09:59 -0700)
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>
commit-graph.c

index f013a84e294b13b552b62257bbf2fa7e1c353a82..e4f1a5b2f1aecf5217a9c3606fee4e625ec83862 100644 (file)
@@ -23,6 +23,7 @@
 #define GRAPH_CHUNKID_DATA 0x43444154 /* "CDAT" */
 #define GRAPH_CHUNKID_EXTRAEDGES 0x45444745 /* "EDGE" */
 #define GRAPH_CHUNKID_BASE 0x42415345 /* "BASE" */
+#define MAX_NUM_CHUNKS 5
 
 #define GRAPH_DATA_WIDTH (the_hash_algo->rawsz + 16)
 
@@ -1350,8 +1351,8 @@ static int write_commit_graph_file(struct write_commit_graph_context *ctx)
        int fd;
        struct hashfile *f;
        struct lock_file lk = LOCK_INIT;
-       uint32_t chunk_ids[6];
-       uint64_t chunk_offsets[6];
+       uint32_t chunk_ids[MAX_NUM_CHUNKS + 1];
+       uint64_t chunk_offsets[MAX_NUM_CHUNKS + 1];
        const unsigned hashsz = the_hash_algo->rawsz;
        struct strbuf progress_title = STRBUF_INIT;
        int num_chunks = 3;