bfg-repo-cleaner icon indicating copy to clipboard operation
bfg-repo-cleaner copied to clipboard

LargeObjectException

Open morness opened this issue 7 years ago • 4 comments

I tried a couple variations of --delete-files and --delete-folders and get an exception. Our .git folder is quite large -- 5.61GB and contains a lot of binary data. Here's the command and the error. Please help!

I'm really trying to split the repo up but want to preserve the commit history for the parts I'm keeping. So the approach I've taken is to make an entire copy of the repo, make a new origin, and then forcibly delete everything that I don't care about.

java -jar bfg-1.12.15.jar --delete-files mygame.exe

Using repo : E:\projects\mygame\.git

Exception in thread "main" org.eclipse.jgit.errors.LargeObjectException: 6975cce5a241caafe49727973d6af82cc11f42d7 exceeds size limit
        at org.eclipse.jgit.internal.storage.file.UnpackedObject$LargeObject.getCachedBytes(UnpackedObject.java:392)
        at org.eclipse.jgit.treewalk.CanonicalTreeParser.reset(CanonicalTreeParser.java:214)
        at org.eclipse.jgit.treewalk.CanonicalTreeParser.createSubtreeIterator0(CanonicalTreeParser.java:248)
        at org.eclipse.jgit.treewalk.CanonicalTreeParser.createSubtreeIterator(CanonicalTreeParser.java:226)
        at org.eclipse.jgit.treewalk.CanonicalTreeParser.createSubtreeIterator(CanonicalTreeParser.java:70)
        at org.eclipse.jgit.treewalk.TreeWalk.enterSubtree(TreeWalk.java:1210)
        at org.eclipse.jgit.treewalk.TreeWalk.next(TreeWalk.java:828)
        at com.madgag.git.package$RichTreeWalk$$anon$1.next(package.scala:135)
        at scala.collection.Iterator$class.foreach(Iterator.scala:893)
        at com.madgag.git.package$RichTreeWalk$$anon$1.foreach(package.scala:128)
        at scala.collection.generic.Growable$class.$plus$plus$eq(Growable.scala:59)
        at scala.collection.mutable.SetBuilder.$plus$plus$eq(SetBuilder.scala:20)
        at scala.collection.TraversableOnce$class.to(TraversableOnce.scala:310)
        at com.madgag.git.package$RichTreeWalk$$anon$1.to(package.scala:128)
        at scala.collection.TraversableOnce$class.toSet(TraversableOnce.scala:304)
        at com.madgag.git.package$RichTreeWalk$$anon$1.toSet(package.scala:128)
        at com.madgag.git.package$.allBlobsUnder(package.scala:268)
        at com.madgag.git.bfg.cleaner.protection.ProtectedObjectCensus$$anonfun$6.apply(ProtectedObjectCensus.scala:83)
        at com.madgag.git.bfg.cleaner.protection.ProtectedObjectCensus$$anonfun$6.apply(ProtectedObjectCensus.scala:83)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
        at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
        at scala.collection.Iterator$class.foreach(Iterator.scala:893)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)
        at scala.collection.MapLike$DefaultKeySet.foreach(MapLike.scala:174)
        at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
        at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
        at com.madgag.git.bfg.cleaner.protection.ProtectedObjectCensus$.apply(ProtectedObjectCensus.scala:83)
        at com.madgag.git.bfg.cli.CLIConfig.objectProtection$lzycompute(CLIConfig.scala:145)
        at com.madgag.git.bfg.cli.CLIConfig.objectProtection(CLIConfig.scala:145)
        at com.madgag.git.bfg.cli.Main$$anonfun$1.apply(Main.scala:58)
        at com.madgag.git.bfg.cli.Main$$anonfun$1.apply(Main.scala:35)
        at scala.Option.map(Option.scala:146)
        at com.madgag.git.bfg.cli.Main$.delayedEndpoint$com$madgag$git$bfg$cli$Main$1(Main.scala:34)
        at com.madgag.git.bfg.cli.Main$delayedInit$body.apply(Main.scala:28)
        at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
        at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
        at scala.App$$anonfun$main$1.apply(App.scala:76)
        at scala.App$$anonfun$main$1.apply(App.scala:76)
        at scala.collection.immutable.List.foreach(List.scala:381)
        at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
        at scala.App$class.main(App.scala:76)
        at com.madgag.git.bfg.cli.Main$.main(Main.scala:28)
        at com.madgag.git.bfg.cli.Main.main(Main.scala)

morness avatar Aug 01 '17 20:08 morness

You haven't used the massive-non-file-objects-sized-up-to option, which is designed to help with that. Try running with e.g. --massive-non-file-objects-sized-up-to 20M.

javabrett avatar Aug 02 '17 01:08 javabrett

Maybe it would be interesting that it would suggest to use that option instead of dying completely.

Thanks

pacho2 avatar Apr 09 '19 12:04 pacho2

I just had the same problem with a project I was assisting and I can confirm that the --massive-non-file-objects-sized-up-to did the trick. I second the suggestion above that the tool should inform that it couldn't act due to a file size limit instead of just crashing altogether. Thanks!

brucebarrera avatar Nov 05 '21 18:11 brucebarrera

Assuming that you're in your repo the command would look like the following, assuming that your running in Windows

java -jar ..\bfg-1.14.0.jar -D file.txt . --massive-non-file-objects-sized-up-to 4G

kfordaccela avatar Mar 04 '22 18:03 kfordaccela