Scenes diff like code
A .pitofx in git reads as TOML.
What the diff shows
A .pitofx is compressed, so git sees it as binary and git diff says only Binary files differ. pfx gives git a text view of it instead: git diff, git log -p and git show print the document as TOML, so a scene change reads like a code change. The file in the repository stays the .pitofx.
-
One value, one line
Change one value and the diff shows that line, with the recipe's new hash in the metadata. The TOML entries print whole: the scene's metadata, the recipe, each scene file, each .toml file the document holds and the builder's overrides.
-
No churn
Entries print in an order set by what the document holds, never by where its chunks sit, so an edit in place, a compact and a save that writes the chunks in another order print the same text.
-
Packed files, one line
Each other entry prints one line, its size and its CRC-32: packed meshes, images and other files, the build's entries and the thumbnail. Nothing is decompressed to list it, so the diff of a document holding gigabytes of meshes costs what its TOML costs.
-
Merges stay binary
When two branches change the same document, git keeps the current branch's copy and reports a conflict. Carry the other side's edits over with
pfx scene printandpfx scene write, or in the editor.
Measured
How to use it
-
Run it once, from inside the repository:
pfx git setup -
Each clone runs it once.
pfx newdoes it for you when it scaffolds a game inside a git repository. -
Run again,
pfx git setupchanges nothing and saysalready there. Outside a git repository it refuses in one line and exits 1. With--jsonit prints one object: the repository, the attributes line and each config key, each with whether it changed. Git andpfxmust both be onPATH, since git runs the driver by name.
What it writes
Two things and nothing else.
-
.gitattributes
At the repository's top, appended when no line for
*.pitofxnamesdiff=pitofxyet. Commit it, so every clone tags its.pitofxfiles the same way.*.pitofx diff=pitofx -
Local git config
In
.git/config, never the global one. Git keeps local config out of commits, so each clone runspfx git setuponce; without it, git falls back toBinary files differ.diff.pitofx.textconv = pfx scene print --all diff.pitofx.binary = false -
By hand
The same two steps without
pfx git setup:echo '*.pitofx diff=pitofx' >> .gitattributes git config diff.pitofx.textconv 'pfx scene print --all'