From 89e2c41c46d0893c9ac80ce6804cd6aeff2fbc02 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Wed, 24 Aug 2016 22:52:17 +1200 Subject: Refine git prompt commands a bit Informed by git-prompt.sh from the Git source distribution --- bash/bashrc.d/prompt.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'bash/bashrc.d') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 1a7a1c6f..ea2ba7f2 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -126,15 +126,16 @@ prompt() { ((ahead)) && state=${state}'>' # Tracked files are modified - git diff-files --quiet || + git diff-files --no-ext-diff --quiet || state=${state}'!' # Changes are staged - git diff-index --cached --quiet HEAD 2>/dev/null || + git diff-index --cached --no-ext-diff --quiet HEAD 2>/dev/null || state=${state}'+' # There are some untracked and unignored files - [[ -n $(git ls-files --others --exclude-standard) ]] && + git ls-files --directory --error-unmatch --exclude-standard \ + --no-empty-directory --others -- ':/*' >/dev/null 2>&1 && state=${state}'?' # There are stashed changes -- cgit v1.2.3