commit-graph: fix documentation inconsistencies

The commit-graph feature shipped in Git 2.18 has some inconsistencies in the constants used by the implementation and specified by the format document. The commit data chunk uses the key "CDAT" in the file format, but was previously documented to say "CGET". The commit data chunk stores commit parents using two 32-bit fields that typically store the integer position of the parent in the list of commit ids within the commit-graph file. When a parent does not exist, we had documented the value 0xffffffff, but implemented the value 0x70000000. This swap is easy to correct in the documentation, but unfortunately reduces the number of commits that we can store in the commit-graph. Update that estimate, too. Reported-by: Grant Welch <gwelch925@gmail.com> Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Jun 28, 2018 at 12:52 UTC a9aa3c09270698ef3c15ec20013bd5a1abae0dea
1 file changed +5 -5
Documentation/technical/commit-graph-format.txt
+5 -5
@@ -18,9 +18,9 @@ metadata, including:
18 the graph file.
19
20 These positional references are stored as unsigned 32-bit integers
21 -corresponding to the array position withing the list of commit OIDs. We
22 -use the most-significant bit for special purposes, so we can store at most
23 -(1 << 31) - 1 (around 2 billion) commits.
21 +corresponding to the array position withing the list of commit OIDs. Due
22 +to some special constants we use to track parents, we can store at most
23 +(1 << 30) + (1 << 29) + (1 << 28) - 1 (around 1.8 billion) commits.
24
25 == Commit graph files have the following format:
26
@@ -70,10 +70,10 @@ CHUNK DATA:
70 OID Lookup (ID: {'O', 'I', 'D', 'L'}) (N * H bytes)
71 The OIDs for all commits in the graph, sorted in ascending order.
72
73 - Commit Data (ID: {'C', 'G', 'E', 'T' }) (N * (H + 16) bytes)
73 + Commit Data (ID: {'C', 'D', 'A', 'T' }) (N * (H + 16) bytes)
74 * The first H bytes are for the OID of the root tree.
75 * The next 8 bytes are for the positions of the first two parents
76 - of the ith commit. Stores value 0xffffffff if no parent in that
76 + of the ith commit. Stores value 0x7000000 if no parent in that
77 position. If there are more than two parents, the second value
78 has its most-significant bit on and the other bits store an array
79 position into the Large Edge List chunk.