forked from pwaller/git-minecraft-smudge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
81 lines (54 loc) · 2.44 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
** 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.