]> source.dussan.org Git - jgit.git/commit
gc: loosen unreferenced objects 55/89455/4
authorDavid Turner <dturner@twosigma.com>
Tue, 24 Jan 2017 16:31:22 +0000 (11:31 -0500)
committerJonathan Nieder <jrn@google.com>
Tue, 24 Jan 2017 22:22:45 +0000 (14:22 -0800)
commit8bec98cec089fa488f3903e97ee6493b727d7d21
tree3c80dadb41524f9979a52c18b8eafc9ed8051198
parentd3c4c0622f1f007e481112613acd9935d999b358
gc: loosen unreferenced objects

An unreferenced object might appear in a pack.  This could only happen
because it was previously referenced, and then later that reference
was removed.  When we gc, we copy the referenced objects into a new
pack, and delete the old pack.  This would remove the unreferenced
object.  Now we first create a loose object from any unreferenced
object in the doomed pack.  This kicks off the two-week grace period
for that object, after which it will be collected if it's not
referenced.

This matches the behavior of regular git.

Change-Id: I59539aca1d0d83622c41aa9bfbdd72fa868ee9fb
Signed-off-by: David Turner <dturner@twosigma.com>
Signed-off-by: Jonathan Nieder <jrn@google.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcBasicPackingTest.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectoryInserter.java