dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

commit e823cbfea21eadb8c3915dc65bdb3e7d799d6717
parent c5068b8b8a10e692350ef0cfce2802f559d4fbef
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Wed, 25 Sep 2019 05:19:16 -0400

shrc: Add dirty state to Git status in $PS1

Diffstat:
M.shrc | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/.shrc b/.shrc @@ -23,6 +23,15 @@ __ps1() { gitref=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) [ $? -ne 0 ] && gitref="GIT: empty" [ "$gitref" = HEAD ] && gitref=\($(git rev-parse --short HEAD)\) + git diff --no-ext-diff --quiet || status="*" + git diff --no-ext-diff --cached --quiet || status="$status+" + if [ "$(git config --bool sh.showUntrackedFiles)" != "false" ] && + git ls-files --others --exclude-standard --directory \ + --no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null + then + status="$status%" + fi + [ -n "$status" ] && gitref="$gitref $status" echo " ($gitref)" else echo