Releases: rtyley/bfg-repo-cleaner
Update to Scala 2.13
Update done with #425 - updating to this Scala version should be invisible to users.
I've had to change the implementation of the --replace-text
feature (using https://github.com/rtyley/line-break-preserving-line-splitting rather than the abandoned scala-io
library), it should be-like-for-like, and has been fairly extensively tested, but let me know if you encounter any weird issues.
Now with Scala 2.12 and Java 8
This release updates the BFG to use Scala 2.12 (from 2.11), which in turn raises the requirement for Java to Java 8.
This makes BFG v1.12.3 the last version to support Java 6, and BFG v1.12.16 the last version to support Java 7.
I've added a new helper library use-newer-java
to guard against lower Java versions- it'll display a message like this:
Looks like your version of Java (1.7) is too old to run this program.
You'll need to get Java 8 or later.
That might sound like a pretty minimal message, but it is at least better than java.lang.UnsupportedClassVersionError : Unsupported major.minor version 52.0
, which is the default exception thrown when the version of Java is too old!
Git LFS support
You can now use the BFG to convert an existing Git repository to the Git LFS format - so all your huge files can be extracted and safely replaced with Git LFS pointer files throughout your repository history. The new command line option is --convert-to-git-lfs
, and you give it a glob expression, like *.wav
, just like you do with git lfs track
:
$ java -jar ~/bfg-1.12.5.jar --convert-to-git-lfs '*.wav' --no-blob-protection
This will reduce the size of your core Git repo, while still keeping those files readily available in the secondary Git LFS store.
A full step-by-step example of doing this on the command line:
$ git clone --mirror heavy-repo # a 'bare' repo, with all branches and tags
$ cd heavy-repo.git # Now is a good time to make a backup!
$ java -jar ~/bfg-1.12.5.jar --convert-to-git-lfs '*.wav' --no-blob-protection
# the BFG rewrites history, extracting files to lfs/objects and adding .gitattributes for LFS tracking
$ git reflog expire --expire=now --all && git gc --prune=now
$ git lfs init
# let's push everything up to your Git LFS-enabled hosting provider:
$ git remote set-url origin [email protected]:some-org/heavy-repo.git
$ git push # because you cloned using --mirror, this will push ALL branches and tags
You want to be using a least Git LFS 1.0.0 or above (which includes some recent changes to improve pushing from bare repos).
BFG v1.12.4 - now requires Java 7
This bumps a few dependency versions, specifically JGit, which now requires Java 7, ending Java 6 support in the BFG. You'll get an immediatejava.lang.UnsupportedClassVersionError
if you try to run BFG v1.12.4 with Java 6.
You can get the latest version of Java (currently Java 8) here:
If you really want to run with Java 6, BFG v1.12.3 is the final version you'll be able to use.
Early cut at supporting Git LFS
This rough cut allows a user to convert a Git repositories history to Git LFS - files are replaced with pointers, and history is rewritten.
$ java -jar bfg.jar --convert-to-git-lfs -fi *.png --no-blob-protection
Deleted & changed files now reported!
This should make seeing what the BFG has got up to a lot easier - the new output looks like this (and it only appears if files have been changed, or deleted, as appropriate).
Changed files
-------------
Filename Before & After
--------------------------------------------------------------------------------------------------
CODE.conf | e3aa4a56 ⇒ b9241055, 6fd90c18 ⇒ 1f390cd7, ...
PROD.conf | 5a89032a ⇒ 38193000, 2611394d ⇒ 9c742f65, ...
Deleted files
-------------
Filename Git id
------------------------------------------------
bg.jpg | d0ea4091 (2.0 MB)
guardian_space002.png | 24215b1e (1.2 MB)
Now with Scala v2.11...
The BFG has been updated to run on the latest Scala release, v2.11!
Other than a detour to release a v2.11-compatible version of scala-io
, the upgrade went very smoothly. Benchmarks show no performance regressions, and the download size is half a megabyte smaller 😄
Note that although the final v2.11.0 scala-lang artifacts have been tagged and published, they haven't been officially announced yet - the most recent announcement is for v2.11.0-RC4.
v1.11.2
v1.11.1
For any people who've been affected by libgit2/libgit2#2085 (comment) (git fsck
will show error in tree xxxxxxx: contains duplicate file entries
in affected repos) - this latest release of The BFG adds a switch to make removing the duplicate tree-entries easy:
$ bfg --fix-filename-duplicates-preferring tree
I've tested this against a copy of the corrupted CocoaPods/Specs repo, getting a clean git fsck
in just over 2 minutes.