diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 11:32:17 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-21 11:32:17 +1200 |
commit | 0ef61eaf131888c873a2df1dccb04b34bb7e7383 (patch) | |
tree | c196e970c53d01f971a19e3ccec1343f75111fe0 /pdksh | |
parent | Merge branch 'master' into openbsd (diff) | |
download | dotfiles-0ef61eaf131888c873a2df1dccb04b34bb7e7383.tar.gz dotfiles-0ef61eaf131888c873a2df1dccb04b34bb7e7383.zip |
Add bash prompt Git fixes into pdksh
Diffstat (limited to 'pdksh')
-rw-r--r-- | pdksh/pdkshrc.d/prompt.pdksh | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/pdksh/pdkshrc.d/prompt.pdksh b/pdksh/pdkshrc.d/prompt.pdksh index 71e952a0..2486373d 100644 --- a/pdksh/pdkshrc.d/prompt.pdksh +++ b/pdksh/pdkshrc.d/prompt.pdksh @@ -95,21 +95,19 @@ prompt() { fi branch=${branch##*/} + # Refresh index so e.g. git-diff-files(1) is accurate + git update-index --refresh >/dev/null + + # Collect symbols representing repository state typeset state - if ! git diff-files --quiet ; then - # Two exclamation marks, as that's how you get a literal "!" in - # a pdksh PS1 + git diff-files --quiet || state=${state}!! - fi - if ! git diff-index --cached --quiet HEAD ; then + git diff-index --cached --quiet HEAD || state=${state}+ - fi - if [[ -n $(git ls-files --others --exclude-standard) ]] ; then - state=${state}? - fi - if git rev-parse --verify refs/stash >/dev/null 2>&1 ; then + [[ -n $(git ls-files --others --exclude-standard) ]] && + state=${state}\? + git rev-parse --quiet --verify refs/stash >/dev/null && state=${state}^ - fi # Print the status in brackets; add a git: prefix only if there # might be another VCS prompt (because PROMPT_VCS is set) |