aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.server/src/org/eclipse/jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2011-03-18 10:23:21 -0700
committerShawn O. Pearce <spearce@spearce.org>2011-04-01 17:40:33 -0400
commit8ac65d33ed7a94f77cb066271669feebf9b882fc (patch)
treebbdc6e766d23c51559c0c3478f6ba7e4ffb6d293 /org.eclipse.jgit.http.server/src/org/eclipse/jgit
parent36a38adf719330a14ddd3f0bf8859cde0166d2ce (diff)
downloadjgit-8ac65d33ed7a94f77cb066271669feebf9b882fc.tar.gz
jgit-8ac65d33ed7a94f77cb066271669feebf9b882fc.zip
PackWriter: Fix the way delta chain cycles are prevented
Take a very simple approach to avoiding delta chains during object reuse: objects are now always selected from the oldest pack that contains them. This prevents cycles because a pack must not have a cycle in the delta chain. If both objects A and B are chosen out of the same source pack then there cannot be an A->B->A cycle. The oldest pack is also the most likely to have the smallest deltas. Its the biggest pack in the system and probably came from the clone (or last GC) of this repository, where all objects were previously considered and packed tightly together. If an object appears again (for example due to a revert and a push into this repository) the newer copy of won't be nearly as small as the older delta version of it, even if the newer one is also itself a delta. ObjectDirectory already enumerates objects during selection in this newest->oldest order, so it already is supplying these assumptions to PackWriter. Taking advantage of this can speed up selection by a tiny amount by avoiding some tests, but can also help to prevent a cycle needing to be broken on the fly during writing. The previous cycle breaking logic wasn't fully correct either. If a different delta base was chosen, the new delta base might not have been written into the output pack before the current object, forcing the use of REF_DELTA when OFS_DELTA is always smaller. This logic has now been reworked to always re-check the delta base and ensure it gets written before the current object. If a cycle occurs, it gets broken the same way as before, by disabling delta reuse and finding an alternative form of the object, which may require inflating/deflating in whole format. Change-Id: I9953ab8be54ceb8b588e1280d6f7edd688887747 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.http.server/src/org/eclipse/jgit')
0 files changed, 0 insertions, 0 deletions