Skip to main content

parse_porcelain

Function parse_porcelain 

Source
pub fn parse_porcelain(output: &str) -> Result<ChangeSet>
Expand description

Parse git status --porcelain=v1 -z output

Format: XY filename\0 where:

  • X = index status
  • Y = working tree status
  • filename = path relative to repo root

Special cases:

  • Renames: R old\0new\0
  • Copies: C old\0new\0
  • Untracked: ?? filename\0
  • Ignored: !! filename\0
  • Merge conflicts: UU filename\0, AA filename\0, etc.

See: https://git-scm.com/docs/git-status#_short_format

ยงErrors

Returns GitError::InvalidOutput when the porcelain stream is malformed (missing status codes, filenames, or rename/copy metadata).