INNER CODE UNIT · Python

GitIgnore

wasm3/wasm3 · extra/format.py:71

class GitIgnore:
    """Every .gitignore in the tree, as fnmatch patterns, read as the walk reaches it.

    What the walk leaves alone: git's own directory, and whatever git is told to ignore.
    The walk starts at the root, so without these it would wander into build trees and
    downloaded toolchains, which dwarf the tree being formatted.

    A .gitignore governs the directory it sits in and everything below, so each one is
    read when the walk enters that directory and matched against paths relative to it.
    Reading them on the way down, rather than gathering them all up front, is also what
    keeps the search for them out of the very trees the outer ones exist to name.

    A trailing `/` is kept and means what git means by it -- the rule matches a
    directory and never a file -- so a rule that names a build tree can be told apart
    from one that would also take a tracked script of the same name.

    Comments, blank lines and `!` negations are skipped: nothing in this tree relies on
    a negation, and a blacklist has no way to express one.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…