~kmaasrud/prompt

238d13f5b29880d7b6d412c7ee354416df2d0255 — kmaasrud 1 year, 6 months ago f3f59f8
add dirty check to git prompt
1 files changed, 11 insertions(+), 0 deletions(-)

M src/git.rs
M src/git.rs => src/git.rs +11 -0
@@ 8,7 8,18 @@ pub fn git<W: Write>(mut w: W) -> Result<(), Error> {
    {
        Ok(abbrev_ref) if abbrev_ref.status.success() => {
            write!(w, "(")?;

            w.write_all(abbrev_ref.stdout.trim_ascii())?;

            if !Command::new("git")
                .args(["diff", "--no-ext-diff", "--exit-code", "--quiet"])
                .output()
                .ok()
                .map_or(false, |output| output.status.success())
            {
                write!(w, "*")?;
            }

            write!(w, ") ")
        }
        _ => Ok(()),