]> source.dussan.org Git - jgit.git/commit
RevWalk: integrate commit-graph with commit parsing 79/183079/53
authorkylezhao <kylezhao@tencent.com>
Wed, 14 Jul 2021 11:02:12 +0000 (19:02 +0800)
committerkylezhao <kylezhao@tencent.com>
Tue, 10 Jan 2023 06:56:33 +0000 (14:56 +0800)
commitde7d06775c5cf071fb5a14b19d230f5e0845b9ef
tree967a126338467cc2088f872b1cfa54ae32984943
parent801a56b48a7fe3c6e171073211cc62194184fe79
RevWalk: integrate commit-graph with commit parsing

RevWalk#createCommit() will inspect the commit-graph file to find the
specified object's graph position and then return a new RevCommitCG
instance.

RevCommitGC is a RevCommit with an additional "pointer" (the position)
to the commit-graph, so it can load the headers and metadata from there
instead of the pack. This saves IO access in walks where the body is not
needed (i.e. #isRetainBody is false and #parseBody is not invoked).

RevWalk uses automatically the commit-graph if available, no action
needed from callers. The commit-graph is fetched on first access from
the reader (that internally can keep it loaded and reuse it between
walks).

The startup cost of reading the entire commit graph is small. After
testing, reading a commit-graph with 1 million commits takes less than
50ms. If we use RepositoryCache, it will not be initialized util the
commit-graph is rewritten.

Bug: 574368
Change-Id: I90d0f64af24f3acc3eae6da984eae302d338f5ee
Signed-off-by: kylezhao <kylezhao@tencent.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkCommitGraphTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraph.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommitCG.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java