Skip to main content

Crate gw_parse

Crate gw_parse 

Source
Expand description

Pure parsers for git’s output. No IO, no terminal.

Structs§

Branch
Commit
Entry
x/y are git’s XY codes (. = unchanged). Untracked is ?/?.
LogRow
One output line of git log --graph: a commit, or a graph-only connector line.
Progress
RefUpdate
Splitter
Streaming splitter: yields a line on \r or \n (a \r\n pair yields one line), even when a line spans several chunks. Bytes are decoded as lossy UTF-8.
Stash
Status
Parsed git status --porcelain=v2 --branch -z.
SubmoduleState

Enums§

Event
One classified line of git output.
PullLine
One classified stdout line. Each variant holds enough to rebuild the line exactly.
PullResult
RefKind

Constants§

BRANCH_FORMAT
Format for git for-each-ref refs/heads parsed by parse_branches.
LOG_FORMAT
Format string for git log --graph: graph prefix, then US-separated fields.
STASH_FORMAT
Format for git stash list parsed by parse_stash_list.
US
Field separator used in the formats below (%x1f / %1f).

Functions§

classify
Classify one line from git’s stderr.
classify_pull_line
is_pack_stats
Pack statistics line (Total 11 (delta 10), reused ...), local or remote:. Not progress and not a server message: callers drop it.
parse_branches
parse_fetch_porcelain
git fetch --porcelain stdout: <flag> <old> <new> <ref>.
parse_graph_line
parse_human_ref_line
Human ref line from pull/clone/fetch stderr (C locale): old..new src -> dst, * [new branch] src -> dst, + a...b src -> dst (forced update).
parse_name_status_z
git diff/show --name-status -z: (code, path, orig); renames/copies carry the source path.
parse_numstat_z
git diff [--cached] --numstat -z: added\tdeleted\tpath\0, renames as added\tdeleted\t\0src\0dst\0.
parse_push_porcelain
git push --porcelain stdout: To <url>, <flag>\t<src>:<dst>\t<summary>, Done.
parse_shortlog
git shortlog -sne: (count, "Name <email>"), most commits first (git’s order).
parse_stash_list
parse_status_v2
parse_submodule_status
git submodule status: [ +-U]<sha> <path>[ (<describe>)] -> path to checked-out sha. Uninitialized (-) submodules have no checkout and are left out.

Type Aliases§

Numstat
Per-file line counts keyed by repo-relative path; None means binary.