aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorIvan Frade <ifrade@google.com>2023-08-16 13:26:39 -0700
committerIvan Frade <ifrade@google.com>2023-08-16 13:31:55 -0700
commit6f733369391ab45987f87102e626c851454ed141 (patch)
tree902b454678eacb5b94c5896186fbdf1d1b8fb2c2 /org.eclipse.jgit
parentb4b8f05eea80d4bf6e17db12e721c24ff3e32c9a (diff)
downloadjgit-6f733369391ab45987f87102e626c851454ed141.tar.gz
jgit-6f733369391ab45987f87102e626c851454ed141.zip
DfsGarbageCollector: put only GC commits into the commit graph
GC puts all commits reachable from heads and tags into the GC pack, and commits reachable only from other refs (e.g. refs/changes) into GC_REST. The commit-graph contains all commits in GC and GC_REST. This produces too big commit graphs in some repos, beating the purpose of loading the index. Limit the commit graph to commits reachable from heads and tags (i.e. commits in the GC pack). Change-Id: I4962faea5a726d2ea3e548af0aeae370a6cc8588
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java5
1 files changed, 1 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
index 8cb94dcf4b..774c9fadda 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java
@@ -783,12 +783,9 @@ public class DfsGarbageCollector {
return;
}
- Set<ObjectId> allTips = refsBefore.stream().map(Ref::getObjectId)
- .collect(Collectors.toUnmodifiableSet());
-
try (DfsOutputStream out = objdb.writeFile(pack, COMMIT_GRAPH);
RevWalk pool = new RevWalk(ctx)) {
- GraphCommits gcs = GraphCommits.fromWalk(pm, allTips, pool);
+ GraphCommits gcs = GraphCommits.fromWalk(pm, allHeadsAndTags, pool);
CountingOutputStream cnt = new CountingOutputStream(out);
CommitGraphWriter writer = new CommitGraphWriter(gcs,
writeBloomFilter);