1GITFORMAT-COMMIT-GRAPH(5)         Git Manual         GITFORMAT-COMMIT-GRAPH(5)
2
3
4

NAME

6       gitformat-commit-graph - Git commit-graph format
7

SYNOPSIS

9       $GIT_DIR/objects/info/commit-graph
10       $GIT_DIR/objects/info/commit-graphs/*
11

DESCRIPTION

13       The Git commit-graph stores a list of commit OIDs and some associated
14       metadata, including:
15
16       •   The generation number of the commit.
17
18       •   The root tree OID.
19
20       •   The commit date.
21
22       •   The parents of the commit, stored using positional references
23           within the graph file.
24
25       •   The Bloom filter of the commit carrying the paths that were changed
26           between the commit and its first parent, if requested.
27
28       These positional references are stored as unsigned 32-bit integers
29       corresponding to the array position within the list of commit OIDs. Due
30       to some special constants we use to track parents, we can store at most
31       (1 << 30) + (1 << 29) + (1 << 28) - 1 (around 1.8 billion) commits.
32

COMMIT-GRAPH FILES HAVE THE FOLLOWING FORMAT:

34       In order to allow extensions that add extra data to the graph, we
35       organize the body into "chunks" and provide a binary lookup table at
36       the beginning of the body. The header includes certain values, such as
37       number of chunks and hash type.
38
39       All multi-byte numbers are in network byte order.
40
41   HEADER:
42           4-byte signature:
43               The signature is: {'C', 'G', 'P', 'H'}
44
45           1-byte version number:
46               Currently, the only valid version is 1.
47
48            1-byte Hash Version
49                We infer the hash length (H) from this value:
50           1 => SHA-1
51           2 => SHA-256
52                If the hash type does not match the repository's hash algorithm, the
53                commit-graph file should be ignored with a warning presented to the
54                user.
55
56           1-byte number (C) of "chunks"
57
58           1-byte number (B) of base commit-graphs
59               We infer the length (H*B) of the Base Graphs chunk
60               from this value.
61
62   CHUNK LOOKUP:
63           (C + 1) * 12 bytes listing the table of contents for the chunks:
64               First 4 bytes describe the chunk id. Value 0 is a terminating label.
65               Other 8 bytes provide the byte-offset in current file for chunk to
66               start. (Chunks are ordered contiguously in the file, so you can infer
67               the length using the next chunk position if necessary.) Each chunk
68               ID appears at most once.
69
70           The CHUNK LOOKUP matches the table of contents from
71           the chunk-based file format, see linkgit:gitformat-chunk[5]
72
73           The remaining data in the body is described one chunk at a time, and
74           these chunks may be given in any order. Chunks are required unless
75           otherwise specified.
76
77   CHUNK DATA:
78       OID Fanout (ID: {O, I, D, F}) (256 * 4 bytes)
79               The ith entry, F[i], stores the number of OIDs with first
80               byte at most i. Thus F[255] stores the total
81               number of commits (N).
82
83       OID Lookup (ID: {O, I, D, L}) (N * H bytes)
84               The OIDs for all commits in the graph, sorted in ascending order.
85
86       Commit Data (ID: {C, D, A, T }) (N * (H + 16) bytes)
87           •   The first H bytes are for the OID of the root tree.
88
89           •   The next 8 bytes are for the positions of the first two parents
90               of the ith commit. Stores value 0x70000000 if no parent in that
91               position. If there are more than two parents, the second value
92               has its most-significant bit on and the other bits store an
93               array position into the Extra Edge List chunk.
94
95           •   The next 8 bytes store the topological level (generation number
96               v1) of the commit and the commit time in seconds since EPOCH.
97               The generation number uses the higher 30 bits of the first 4
98               bytes, while the commit time uses the 32 bits of the second 4
99               bytes, along with the lowest 2 bits of the lowest byte, storing
100               the 33rd and 34th bit of the commit time.
101
102       Generation Data (ID: {G, D, A, 2 }) (N * 4 bytes) [Optional]
103           •   This list of 4-byte values store corrected commit date offsets
104               for the commits, arranged in the same order as commit data
105               chunk.
106
107           •   If the corrected commit date offset cannot be stored within 31
108               bits, the value has its most-significant bit on and the other
109               bits store the position of corrected commit date into the
110               Generation Data Overflow chunk.
111
112           •   Generation Data chunk is present only when commit-graph file is
113               written by compatible versions of Git and in case of split
114               commit-graph chains, the topmost layer also has Generation Data
115               chunk.
116
117       Generation Data Overflow (ID: {G, D, O, 2 }) [Optional]
118           •   This list of 8-byte values stores the corrected commit date
119               offsets for commits with corrected commit date offsets that
120               cannot be stored within 31 bits.
121
122           •   Generation Data Overflow chunk is present only when Generation
123               Data chunk is present and atleast one corrected commit date
124               offset cannot be stored within 31 bits.
125
126       Extra Edge List (ID: {E, D, G, E}) [Optional]
127               This list of 4-byte values store the second through nth parents for
128               all octopus merges. The second parent value in the commit data stores
129               an array position within this list along with the most-significant bit
130               on. Starting at that array position, iterate through this list of commit
131               positions for the parents until reaching a value with the most-significant
132               bit on. The other bits correspond to the position of the last parent.
133
134       Bloom Filter Index (ID: {B, I, D, X}) (N * 4 bytes) [Optional]
135           •   The ith entry, BIDX[i], stores the number of bytes in all Bloom
136               filters from commit 0 to commit i (inclusive) in lexicographic
137               order. The Bloom filter for the i-th commit spans from
138               BIDX[i-1] to BIDX[i] (plus header length), where BIDX[-1] is 0.
139
140           •   The BIDX chunk is ignored if the BDAT chunk is not present.
141
142       Bloom Filter Data (ID: {B, D, A, T}) [Optional]
143           •   It starts with header consisting of three unsigned 32-bit
144               integers:
145
146               •   Version of the hash algorithm being used. We currently only
147                   support value 1 which corresponds to the 32-bit version of
148                   the murmur3 hash implemented exactly as described in
149                   https://en.wikipedia.org/wiki/MurmurHash#Algorithm and the
150                   double hashing technique using seed values 0x293ae76f and
151                   0x7e646e2 as described in
152                   https://doi.org/10.1007/978-3-540-30494-4_26 "Bloom Filters
153                   in Probabilistic Verification"
154
155               •   The number of times a path is hashed and hence the number
156                   of bit positions that cumulatively determine whether a file
157                   is present in the commit.
158
159               •   The minimum number of bits b per entry in the Bloom filter.
160                   If the filter contains n entries, then the filter size is
161                   the minimum number of 64-bit words that contain n*b bits.
162
163           •   The rest of the chunk is the concatenation of all the computed
164               Bloom filters for the commits in lexicographic order.
165
166           •   Note: Commits with no changes or more than 512 changes have
167               Bloom filters of length one, with either all bits set to zero
168               or one respectively.
169
170           •   The BDAT chunk is present if and only if BIDX is present.
171
172       Base Graphs List (ID: {B, A, S, E}) [Optional]
173               This list of H-byte hashes describe a set of B commit-graph files that
174               form a commit-graph chain. The graph position for the ith commit in this
175               file's OID Lookup chunk is equal to i plus the number of commits in all
176               base graphs.  If B is non-zero, this chunk must exist.
177
178   TRAILER:
179           H-byte HASH-checksum of all of the above.
180

HISTORICAL NOTES:

182       The Generation Data (GDA2) and Generation Data Overflow (GDO2) chunks
183       have the number 2 in their chunk IDs because a previous version of Git
184       wrote possibly erroneous data in these chunks with the IDs "GDAT" and
185       "GDOV". By changing the IDs, newer versions of Git will silently ignore
186       those older chunks and write the new information without trusting the
187       incorrect data.
188

GIT

190       Part of the git(1) suite
191
192
193
194Git 2.43.0                        11/20/2023         GITFORMAT-COMMIT-GRAPH(5)
Impressum