From 3e246a919a2dc6d143af359bd1a1366389f41b75 Mon Sep 17 00:00:00 2001 From: Alexander Karle Date: Sun, 2 Dec 2018 23:27:03 -0500 Subject: [PATCH] [bash] cleaner parsing of dirty git repo for bash_prompt I found out about --porcelain=v1 as a backward compatible way to check if it is clean / dirty. It returns empty if clean, so that simplifies the parse_git_dirty function a good bit. --- bash/bash_prompt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bash/bash_prompt b/bash/bash_prompt index fe7ff1c..60eca7f 100644 --- a/bash/bash_prompt +++ b/bash/bash_prompt @@ -19,8 +19,7 @@ else fi function parse_git_dirty() { - [[ $(git status 2> /dev/null | tail -n1) != *"working directory clean"* ]] && \ - [[ $(git status 2> /dev/null | tail -n1) != *"working tree clean"* ]] && echo "*" + [ "$(git status --porcelain=v1 2> /dev/null)" ] && echo "*" } function parse_git_branch() { -- libgit2 0.28.4