Skip to content

(defunct) Abusing git's filter mechanism for fun and profit.

Notifications You must be signed in to change notification settings

iAmiRNA/git-minecraft-smudge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

** THIS PROJECT IS DEFUNCT **

It remains here as a reminder of what I did.

It was a nice idea and it does achieve an awesome compression ratio, but it is
very time consuming `bup` beats it for convenience. Unfortunately, git doesn't
generate great packs, so frequent repacking is needed in order to achieve good
delta compression. After a month of hourly backups, this takes hours.

Keeping the world files in the same repository as the configuration also proved
to be a mistake, as all git operations (status, add, etc) have to run the files
through the smudge filter. This is painfully slow.

If I was doing it again, I'd recommend trying out `bup` and maybe try using it
as a backend for `git-annex`.


git-minecraft-smudge
--------------------

Abusing git's filter mechanism for fun and profit.

note: This is a crazy thing to do and should be considered untested.

You have been warned.

Purpose
-------

This results in a drastic space saving when using git to track minecraft anvil
files. It works by decompressing minecraft's chunk data so that git's delta
compression can work more effectively on it.

Why?
----

I want to have backups for two purposes, one to see how it evolves over a long
period of time, and another in case we have a severe problem (nuke going off)
which we need to fix.

Result
------
For 10 saves with a significant amount of stuff done to them, the resulting git
repository was only 7% larger than the final save itself. A regular `git gc` is
needed.

Usage
-----

In your `.gitconfig` (doesn't cause anything by itself):

	[filter "minecraft-anvil"]
		clean = git-minecraft-smudge clean -
		smudge = git-minecraft-smudge smudge -

and in your `.gitattributes` in your world folder or higher:

	*.mca minecraft-anvil

note: this renders the repository unusable without `git-minecraft-smudge`.


Implementation details
---------------------

Unfortunately java's zlib implementation does something different to go's,
which I wasn't able to figure out. So instead I call upon java just to do the
compression.

I also wanted to just have one binary named `git-minecraft-smudge` that did
everything, so the `Makefile` embeds the `.jar` into the binary which is
unpacked at runtime.

Notes
-----

This seriously slows down many git operations including `status` `add` and
`commit`, since it must put all files with modified timestamps through the
`clean` phase, which is time consuming since it always verifies that it can
repack the file to exactly the same contents.

About

(defunct) Abusing git's filter mechanism for fun and profit.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 89.0%
  • Java 11.0%