Skip to main content

parse_status_z

Function parse_status_z 

Source
pub fn parse_status_z(bytes: &[u8]) -> DirtyState
Expand description

Parse the NUL-separated porcelain v1 status. Renames are disabled by the caller (--no-renames), so every entry is XY path\0 and no entry is followed by a second path.

use majordomus_cli::worktree::state::parse_status_z;
let s = parse_status_z(b"M  a\0 M b\0?? c\0UU d\0MM e\0");
assert_eq!((s.staged, s.unstaged, s.untracked, s.conflicted), (2, 2, 1, 1));
assert!(!s.clean);
assert!(parse_status_z(b"").clean);