module Git::Parsers::Status

Parser for ‘git status –porcelain=v2 -z` output

Builds one {Git::StatusFileInfo} per entry. With ‘-z` every entry is NUL-terminated and paths are emitted verbatim (no quoting), so a path may contain spaces but never a NUL. The original path of a rename or copy entry is the NUL-terminated token that follows the entry.

Every entry type of the porcelain v2 format is handled: ‘1` (ordinary), `2` (rename or copy), `u` (unmerged), `?` (untracked), and `!` (ignored). `#` header lines, emitted with `–branch` or `–show-stash`, are skipped.

{Git::StatusFileInfo} lives at the top-level ‘Git::` namespace rather than within `Git::Parsers::` because it is public API returned to callers, while this parser is infrastructure.

@example Parse the output of ‘git status –porcelain=v2 -z`

Git::Parsers::Status.parse("? new.txt\0")
#=> [#<data Git::StatusFileInfo path="new.txt", index_status="?", ...>]

@see git-scm.com/docs/git-status#_porcelain_format_version_2

@api private