summaryrefslogtreecommitdiff
path: root/Documentation/technical/commit-graph.txt
diff options
context:
space:
mode:
authorLibravatar Derrick Stolee <dstolee@microsoft.com>2019-06-18 11:14:31 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-06-19 20:46:26 -0700
commit8d84097f9655a954ea7e94ba08d93e5940ccb2ae (patch)
treea03d339c93622614583625570967a94365add6b7 /Documentation/technical/commit-graph.txt
parentcommit-graph: allow cross-alternate chains (diff)
downloadtgif-8d84097f9655a954ea7e94ba08d93e5940ccb2ae.tar.xz
commit-graph: expire commit-graph files
As we merge commit-graph files in a commit-graph chain, we should clean up the files that are no longer used. This change introduces an 'expiry_window' value to the context, which is always zero (for now). We then check the modified time of each graph-{hash}.graph file in the $OBJDIR/info/commit-graphs folder and unlink the files that are older than the expiry_window. Since this is always zero, this immediately clears all unused graph files. We will update the value to match a config setting in a future change. Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/technical/commit-graph.txt')
-rw-r--r--Documentation/technical/commit-graph.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/technical/commit-graph.txt b/Documentation/technical/commit-graph.txt
index 473032e476..aed4350a59 100644
--- a/Documentation/technical/commit-graph.txt
+++ b/Documentation/technical/commit-graph.txt
@@ -266,6 +266,21 @@ The merge strategy values (2 for the size multiple, 64,000 for the maximum
number of commits) could be extracted into config settings for full
flexibility.
+## Deleting graph-{hash} files
+
+After a new tip file is written, some `graph-{hash}` files may no longer
+be part of a chain. It is important to remove these files from disk, eventually.
+The main reason to delay removal is that another process could read the
+`commit-graph-chain` file before it is rewritten, but then look for the
+`graph-{hash}` files after they are deleted.
+
+To allow holding old split commit-graphs for a while after they are unreferenced,
+we update the modified times of the files when they become unreferenced. Then,
+we scan the `$OBJDIR/info/commit-graphs/` directory for `graph-{hash}`
+files whose modified times are older than a given expiry window. This window
+defaults to zero, but can be changed using command-line arguments or a config
+setting.
+
## Chains across multiple object directories
In a repo with alternates, we look for the `commit-graph-chain` file starting