Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

world_vcs.ignore

The .zmignore / .gitignore rules of a world, in gitignore(5) syntax: * / ? / [abc] / ** globs, ! negation, a leading / anchoring a pattern to its file's directory, a trailing / for directories only, # comments. A deeper ignore file overrides its parents, and the last matching rule wins.

  • setFrom(ignorePaths, read) reads each ignore file at ignorePaths through read and answers the ignore set, { patterns }. /source/agents/.zmignore, which the engine writes for its own records, states its own name as a rule beside the rules it holds.
  • isIgnored(set, path) answers whether path (/source/... or /zero/source/...) matches the set.
  • ruleFor(set, path) answers the { file, rule } that ignores path, or nil.
  • isIgnoreFilePath(path) answers whether path is a .zmignore / .gitignore file. Such a file is matched only by a rule whose last segment is its own name, written out (.zmignore, agents/.zmignore); wildcards and rules naming a folder above it never match it.
local Ignore = require("modules.world_vcs.ignore")
local set = Ignore.setFrom({ "/zero/source/.zmignore" }, vfs.read)
print(Ignore.isIgnored(set, "/source/scene_dirty/entities/a.json"))