Skip to content

Commit

Permalink
docs: move commit-graph format docs to man section 5
Browse files Browse the repository at this point in the history
Continue the move of existing Documentation/technical/* protocol and
file-format documentation into our main documentation space.

By moving the documentation for the commit-graph format into man
section 5 and the new "developerinterfaces" category. This change is
split from subsequent commits due to the relatively large amount of
ASCIIDOC formatting changes that are required.

Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
avar authored and gitster committed Aug 4, 2022
1 parent 844739b commit 8cbace9
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 17 deletions.
1 change: 1 addition & 0 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ MAN1_TXT += gitweb.txt
# man5 / man7 guides (note: new guides should also be added to command-list.txt)
MAN5_TXT += gitattributes.txt
MAN5_TXT += gitformat-bundle.txt
MAN5_TXT += gitformat-commit-graph.txt
MAN5_TXT += githooks.txt
MAN5_TXT += gitignore.txt
MAN5_TXT += gitmailmap.txt
Expand Down
5 changes: 5 additions & 0 deletions Documentation/git-commit-graph.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ $ git rev-parse HEAD | git commit-graph write --stdin-commits --append
------------------------------------------------


FILE FORMAT
-----------

see linkgit:gitformat-commit-graph[5].

GIT
---
Part of the linkgit:git[1] suite
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
Git commit graph format
=======================
gitformat-commit-graph(5)
=========================

NAME
----
gitformat-commit-graph - Git commit graph format

SYNOPSIS
--------
[verse]
$GIT_DIR/objects/info/commit-graph
$GIT_DIR/objects/info/commit-graphs/*

DESCRIPTION
-----------

The Git commit graph stores a list of commit OIDs and some associated
metadata, including:
Expand Down Expand Up @@ -30,7 +43,7 @@ and hash type.

All multi-byte numbers are in network byte order.

HEADER:
=== HEADER:

4-byte signature:
The signature is: {'C', 'G', 'P', 'H'}
Expand All @@ -52,7 +65,7 @@ HEADER:
We infer the length (H*B) of the Base Graphs chunk
from this value.

CHUNK LOOKUP:
=== CHUNK LOOKUP:

(C + 1) * 12 bytes listing the table of contents for the chunks:
First 4 bytes describe the chunk id. Value 0 is a terminating label.
Expand All @@ -68,17 +81,17 @@ CHUNK LOOKUP:
these chunks may be given in any order. Chunks are required unless
otherwise specified.

CHUNK DATA:
=== CHUNK DATA:

OID Fanout (ID: {'O', 'I', 'D', 'F'}) (256 * 4 bytes)
==== 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)
==== 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', 'D', 'A', '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 0x70000000 if no parent in that
Expand All @@ -93,7 +106,7 @@ CHUNK DATA:
2 bits of the lowest byte, storing the 33rd and 34th bit of the
commit time.

Generation Data (ID: {'G', 'D', 'A', '2' }) (N * 4 bytes) [Optional]
==== Generation Data (ID: {'G', 'D', 'A', '2' }) (N * 4 bytes) [Optional]
* This list of 4-byte values store corrected commit date offsets for the
commits, arranged in the same order as commit data chunk.
* If the corrected commit date offset cannot be stored within 31 bits,
Expand All @@ -104,30 +117,30 @@ CHUNK DATA:
by compatible versions of Git and in case of split commit-graph chains,
the topmost layer also has Generation Data chunk.

Generation Data Overflow (ID: {'G', 'D', 'O', '2' }) [Optional]
==== Generation Data Overflow (ID: {'G', 'D', 'O', '2' }) [Optional]
* This list of 8-byte values stores the corrected commit date offsets
for commits with corrected commit date offsets that cannot be
stored within 31 bits.
* Generation Data Overflow chunk is present only when Generation Data
chunk is present and atleast one corrected commit date offset cannot
be stored within 31 bits.

Extra Edge List (ID: {'E', 'D', 'G', 'E'}) [Optional]
==== Extra Edge List (ID: {'E', 'D', 'G', 'E'}) [Optional]
This list of 4-byte values store the second through nth parents for
all octopus merges. The second parent value in the commit data stores
an array position within this list along with the most-significant bit
on. Starting at that array position, iterate through this list of commit
positions for the parents until reaching a value with the most-significant
bit on. The other bits correspond to the position of the last parent.

Bloom Filter Index (ID: {'B', 'I', 'D', 'X'}) (N * 4 bytes) [Optional]
==== Bloom Filter Index (ID: {'B', 'I', 'D', 'X'}) (N * 4 bytes) [Optional]
* The ith entry, BIDX[i], stores the number of bytes in all Bloom filters
from commit 0 to commit i (inclusive) in lexicographic order. The Bloom
filter for the i-th commit spans from BIDX[i-1] to BIDX[i] (plus header
length), where BIDX[-1] is 0.
* The BIDX chunk is ignored if the BDAT chunk is not present.

Bloom Filter Data (ID: {'B', 'D', 'A', 'T'}) [Optional]
==== Bloom Filter Data (ID: {'B', 'D', 'A', 'T'}) [Optional]
* It starts with header consisting of three unsigned 32-bit integers:
- Version of the hash algorithm being used. We currently only support
value 1 which corresponds to the 32-bit version of the murmur3 hash
Expand All @@ -147,13 +160,13 @@ CHUNK DATA:
of length one, with either all bits set to zero or one respectively.
* The BDAT chunk is present if and only if BIDX is present.

Base Graphs List (ID: {'B', 'A', 'S', 'E'}) [Optional]
==== Base Graphs List (ID: {'B', 'A', 'S', 'E'}) [Optional]
This list of H-byte hashes describe a set of B commit-graph files that
form a commit-graph chain. The graph position for the ith commit in this
file's OID Lookup chunk is equal to i plus the number of commits in all
base graphs. If B is non-zero, this chunk must exist.

TRAILER:
=== TRAILER:

H-byte HASH-checksum of all of the above.

Expand All @@ -164,3 +177,7 @@ the number '2' in their chunk IDs because a previous version of Git wrote
possibly erroneous data in these chunks with the IDs "GDAT" and "GDOV". By
changing the IDs, newer versions of Git will silently ignore those older
chunks and write the new information without trusting the incorrect data.

GIT
---
Part of the linkgit:git[1] suite
4 changes: 2 additions & 2 deletions Documentation/technical/chunk-format.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sections of the file. This allows structured access to a large file by
scanning a small "table of contents" for the remaining data. This common
format is used by the `commit-graph` and `multi-pack-index` files. See
link:technical/pack-format.html[the `multi-pack-index` format] and
link:technical/commit-graph-format.html[the `commit-graph` format] for
the `commit-graph` format in linkgit:gitformat-commit-graph[5] for
how they use the chunks to describe structured data.

A chunk-based file format begins with some header information custom to
Expand Down Expand Up @@ -108,7 +108,7 @@ for future formats:
* *commit-graph:* see `write_commit_graph_file()` and `parse_commit_graph()`
in `commit-graph.c` for how the chunk-format API is used to write and
parse the commit-graph file format documented in
link:technical/commit-graph-format.html[the commit-graph file format].
the commit-graph file format in linkgit:gitformat-commit-graph[5].

* *multi-pack-index:* see `write_midx_internal()` and `load_multi_pack_index()`
in `midx.c` for how the chunk-format API is used to write and
Expand Down
1 change: 1 addition & 0 deletions command-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ gitdiffcore guide
giteveryday guide
gitfaq guide
gitformat-bundle developerinterfaces
gitformat-commit-graph developerinterfaces
gitglossary guide
githooks userinterfaces
gitignore userinterfaces
Expand Down

0 comments on commit 8cbace9

Please sign in to comment.