diff options
author | Taylor Blau <me@ttaylorr.com> | 2020-04-14 04:04:17 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-15 16:20:28 (GMT) |
commit | 8a6ac287b2ba5f75bb2d9409dd97e9b501daf253 (patch) | |
tree | ed0fc9f67c9d9369cd12530cf885da21128d797d /Documentation/git-commit-graph.txt | |
parent | fdbde82fe523374b3c5d1f0f01f3c43dcaca9465 (diff) | |
download | git-8a6ac287b2ba5f75bb2d9409dd97e9b501daf253.zip git-8a6ac287b2ba5f75bb2d9409dd97e9b501daf253.tar.gz git-8a6ac287b2ba5f75bb2d9409dd97e9b501daf253.tar.bz2 |
builtin/commit-graph.c: introduce split strategy 'replace'
When using split commit-graphs, it is sometimes useful to completely
replace the commit-graph chain with a new base.
For example, consider a scenario in which a repository builds a new
commit-graph incremental for each push. Occasionally (say, after some
fixed number of pushes), they may wish to rebuild the commit-graph chain
with all reachable commits.
They can do so with
$ git commit-graph write --reachable
but this removes the chain entirely and replaces it with a single
commit-graph in 'objects/info/commit-graph'. Unfortunately, this means
that the next push will have to move this commit-graph into the first
layer of a new chain, and then write its new commits on top.
Avoid such copying entirely by allowing the caller to specify that they
wish to replace the entirety of their commit-graph chain, while also
specifying that the new commit-graph should become the basis of a fresh,
length-one chain.
This addresses the above situation by making it possible for the caller
to instead write:
$ git commit-graph write --reachable --split=replace
which writes a new length-one chain to 'objects/info/commit-graphs',
making the commit-graph incremental generated by the subsequent push
relatively cheap by avoiding the aforementioned copy.
In order to do this, remove an assumption in 'write_commit_graph_file'
that chains are always at least two incrementals long.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-commit-graph.txt')
-rw-r--r-- | Documentation/git-commit-graph.txt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Documentation/git-commit-graph.txt b/Documentation/git-commit-graph.txt index a4c4a64..46f7f7c 100644 --- a/Documentation/git-commit-graph.txt +++ b/Documentation/git-commit-graph.txt @@ -64,9 +64,10 @@ strategy and other splitting options. The new commits not already in the commit-graph are added in a new "tip" file. This file is merged with the existing file if the following merge conditions are met: * If `--split=no-merge` is specified, a merge is never performed, and -the remaining options are ignored. A bare `--split` defers to the -remaining options. (Note that merging a chain of commit graphs replaces -the existing chain with a length-1 chain where the first and only +the remaining options are ignored. `--split=replace` overwrites the +existing chain with a new one. A bare `--split` defers to the remaining +options. (Note that merging a chain of commit graphs replaces the +existing chain with a length-1 chain where the first and only incremental holds the entire graph). + * If `--size-multiple=<X>` is not specified, let `X` equal 2. If the new |