ludic/changes/packignore.md
Orkuncakilkaya cf814d4a97 feat(pack): .packignore, so a pack root can leave build artefacts out
A pack root is packed wholesale, and that is the right default - a game writes
`pack "assets"` and everything it opens is in the pack. What also goes in is
everything the game does NOT open: the preview renders a model pipeline leaves
beside its meshes, the intermediate a texture bake writes and never reads again,
the .blend the .gltf came out of. Nothing errors, nothing looks wrong, and the
app is simply bigger than the game. The only way out the manifest offered was
naming every file by hand, which is worse - a list that goes stale the day
someone adds a texture.

So `.packignore`, with gitignore's rules, because that is the file everyone
already knows. Anchored and floating patterns, `preview/` for directories only,
`*` and `?` stopping at a separator where `**` crosses one, `[a-z]` classes, `!`
re-includes with the last line winning, a deeper file beating a shallower one,
and no re-including out of an ignored directory.

The semantics are not claimed, they are checked: the implementation was diffed
against git itself over two fixtures - 35 paths, 19 patterns, nested ignore
files, directory negation, `[!0-9]` and `\#` escaping - and `git check-ignore`
and `ludic pack` agree on every path.

Two rules of its own, because a pack is not a working tree. `.packignore` is
never packed (nothing reads one at run time, and --no-ignore does not bring it
back). And it governs the project's own roots only: a package's resources - the
renderer's shaders above all - are added after the gather, so a stray `*.frag`
in a game's ignore file cannot quietly un-ship what it needs to draw anything.

`ludic pack` reports what it left out; `--no-ignore` packs everything so you can
see what a rule is costing. `ludic bundle` gathers through the same path, so the
two agree by construction.
2026-09-11 18:29:32 +03:00

1.2 KiB

bump: minor type: feat .packignore — keep build artefacts out of the shipped asset pack.

A pack root is packed wholesale, so everything a model or texture pipeline leaves beside its output ships too: preview renders, bake intermediates, the .blend a .gltf came from. Nothing errors and nothing looks wrong — the app is just bigger than the game. The only way out was naming every file in package.ludic, a list that goes stale the day someone adds a texture.

Put a .packignore beside the assets instead. The rules are gitignore's, down to the parts people rely on without thinking about them: patterns anchored by a slash or floating without one, preview/ for directories only, * and ? stopping at a separator where ** crosses it, [a-z] classes, ! re-includes with the last line winning, a deeper file beating a shallower one, and no re-including out of an ignored directory.

ludic pack reports what it left out, and --no-ignore packs everything so you can see what a rule costs. ludic bundle gathers the same way. .packignore itself is never packed, and the file only governs your own roots — a package's resources, such as the renderer's shaders, are added afterwards and cannot be excluded by accident.