Re: [PATCH v8 03/14] commit-graph: add format document
From: Jakub Narebski <hidden>
Date: 2018-04-13 22:07:17
Derrick Stolee [off-list ref] writes:
On 4/11/2018 4:58 PM, Jakub Narebski wrote:quoted
Derrick Stolee [off-list ref] writes:quoted
+CHUNK DATA: + + OID Fanout (ID: {'O', 'I', 'D', 'F'}) (256 * 4 bytes) + The ith entry, F[i], stores the number of OIDs with first + byte at most i. Thus F[255] stores the total + number of commits (N). + + OID Lookup (ID: {'O', 'I', 'D', 'L'}) (N * H bytes) + The OIDs for all commits in the graph, sorted in ascending order. + + Commit Data (ID: {'C', 'G', 'E', 'T' }) (N * (H + 16) bytes)I think it is a typo, and it should be CDAT, not CGET (CDAT seem to me to stand for Commit DATa): + Commit Data (ID: {'C', 'D', 'A', 'T' }) (N * (H + 16) bytes) This is what you use in actual implementation, in PATCH v8 06/14 DS> +#define GRAPH_SIGNATURE 0x43475048 /* "CGPH" */ DS> +#define GRAPH_CHUNKID_OIDFANOUT 0x4f494446 /* "OIDF" */ DS> +#define GRAPH_CHUNKID_OIDLOOKUP 0x4f49444c /* "OIDL" */ DS> +#define GRAPH_CHUNKID_DATA 0x43444154 /* "CDAT" */ DS> +#define GRAPH_CHUNKID_LARGEEDGES 0x45444745 /* "EDGE" */Documentation bugs are hard to diagnose. Thanks for finding this. I double checked that the hex int "0x43444154" matches "CDAT".
Another possible way of checking the correctness would be to run `hexdump -C` or equivalent on generated commit-graph file. File and chunk headers should be visible in its output.
quoted hunk
Here is a diff to make it match.diff --git a/Documentation/technical/commit-graph-format.txtb/Documentation/technical/commit-graph-format.txt index ad6af8105c..af03501834 100644--- a/Documentation/technical/commit-graph-format.txt +++ b/Documentation/technical/commit-graph-format.txt@@ -70,7 +70,7 @@ CHUNK DATA:OID Lookup (ID: {'O', 'I', 'D', 'L'}) (N * H bytes) The OIDs for all commits in the graph, sorted in ascending order. - Commit Data (ID: {'C', 'G', 'E', 'T' }) (N * (H + 16) bytes) + Commit Data (ID: {'C', 'D', 'A', 'T' }) (N * (H + 16) bytes) * The first H bytes are for the OID of the root tree. * The next 8 bytes are for the positions of the first two parents of the ith commit. Stores value 0xffffffff if no parent in that