Skip to content

Commit c7be885

Browse files
committed
Merge branch 'rj/doc-technical-fixes' into jch
Documentation mark-up fixes. * rj/doc-technical-fixes: doc: commit-graph.adoc: fix up some formatting doc: sparse-checkout.adoc: fix asciidoc warnings doc: remembering-renames.adoc: fix asciidoc warnings
2 parents 88d5dde + 1ffe6a9 commit c7be885

File tree

3 files changed

+473
-380
lines changed

3 files changed

+473
-380
lines changed

Documentation/technical/commit-graph.adoc

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ A consumer may load the following info for a commit from the graph:
3939
Values 1-4 satisfy the requirements of parse_commit_gently().
4040

4141
There are two definitions of generation number:
42+
4243
1. Corrected committer dates (generation number v2)
4344
2. Topological levels (generation number v1)
4445
@@ -158,7 +159,8 @@ number of commits in the full history. By creating a "chain" of commit-graphs,
158159
we enable fast writes of new commit data without rewriting the entire commit
159160
history -- at least, most of the time.
160161

161-
## File Layout
162+
File Layout
163+
~~~~~~~~~~~
162164

163165
A commit-graph chain uses multiple files, and we use a fixed naming convention
164166
to organize these files. Each commit-graph file has a name
@@ -170,11 +172,11 @@ hashes for the files in order from "lowest" to "highest".
170172

171173
For example, if the `commit-graph-chain` file contains the lines
172174

173-
```
175+
----
174176
{hash0}
175177
{hash1}
176178
{hash2}
177-
```
179+
----
178180

179181
then the commit-graph chain looks like the following diagram:
180182

@@ -213,7 +215,8 @@ specifying the hashes of all files in the lower layers. In the above example,
213215
`graph-{hash1}.graph` contains `{hash0}` while `graph-{hash2}.graph` contains
214216
`{hash0}` and `{hash1}`.
215217

216-
## Merging commit-graph files
218+
Merging commit-graph files
219+
~~~~~~~~~~~~~~~~~~~~~~~~~~
217220

218221
If we only added a new commit-graph file on every write, we would run into a
219222
linear search problem through many commit-graph files. Instead, we use a merge
@@ -225,6 +228,7 @@ is determined by the merge strategy that the files should collapse to
225228
the commits in `graph-{hash1}` should be combined into a new `graph-{hash3}`
226229
file.
227230

231+
....
228232
+---------------------+
229233
| |
230234
| (new commits) |
@@ -250,21 +254,23 @@ file.
250254
| |
251255
| |
252256
+-----------------------+
257+
....
253258

254259
During this process, the commits to write are combined, sorted and we write the
255260
contents to a temporary file, all while holding a `commit-graph-chain.lock`
256261
lock-file. When the file is flushed, we rename it to `graph-{hash3}`
257262
according to the computed `{hash3}`. Finally, we write the new chain data to
258263
`commit-graph-chain.lock`:
259264

260-
```
265+
----
261266
{hash3}
262267
{hash0}
263-
```
268+
----
264269

265270
We then close the lock-file.
266271

267-
## Merge Strategy
272+
Merge Strategy
273+
~~~~~~~~~~~~~~
268274

269275
When writing a set of commits that do not exist in the commit-graph stack of
270276
height N, we default to creating a new file at level N + 1. We then decide to
@@ -289,7 +295,8 @@ The merge strategy values (2 for the size multiple, 64,000 for the maximum
289295
number of commits) could be extracted into config settings for full
290296
flexibility.
291297

292-
## Handling Mixed Generation Number Chains
298+
Handling Mixed Generation Number Chains
299+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
293300

294301
With the introduction of generation number v2 and generation data chunk, the
295302
following scenario is possible:
@@ -318,7 +325,8 @@ have corrected commit dates when written by compatible versions of Git. Thus,
318325
rewriting split commit-graph as a single file (`--split=replace`) creates a
319326
single layer with corrected commit dates.
320327

321-
## Deleting graph-{hash} files
328+
Deleting graph-\{hash\} files
329+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322330

323331
After a new tip file is written, some `graph-{hash}` files may no longer
324332
be part of a chain. It is important to remove these files from disk, eventually.
@@ -333,7 +341,8 @@ files whose modified times are older than a given expiry window. This window
333341
defaults to zero, but can be changed using command-line arguments or a config
334342
setting.
335343

336-
## Chains across multiple object directories
344+
Chains across multiple object directories
345+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
337346

338347
In a repo with alternates, we look for the `commit-graph-chain` file starting
339348
in the local object directory and then in each alternate. The first file that

0 commit comments

Comments
 (0)