summaryrefslogtreecommitdiffstats
path: root/bashrc
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-12-11 11:58:22 -0600
committerJesse Luehrs <doy@tozt.net>2009-12-11 11:58:22 -0600
commit82cc353cafab5712a75ddd9803f7817089db3803 (patch)
treed8c1360bcdf00d1c47a217c23e3831736de3429e /bashrc
parent2d70ee9886da7eac133ca5484e400f009894aa11 (diff)
downloadconf-82cc353cafab5712a75ddd9803f7817089db3803.tar.gz
conf-82cc353cafab5712a75ddd9803f7817089db3803.zip
better detection of modified files
Diffstat (limited to 'bashrc')
-rw-r--r--bashrc29
1 files changed, 21 insertions, 8 deletions
diff --git a/bashrc b/bashrc
index 6efc0e8..7cf5db0 100644
--- a/bashrc
+++ b/bashrc
@@ -218,10 +218,20 @@ function _set_vcs {
case "$vcs" in
svn)
vcs_dirty=$([[ -n "$(svn status | grep -v '^?')" ]]; echo $?)
+ if [[ "$vcs_dirty" -eq 0 ]]; then
+ vcs_dirty='*'
+ else
+ vcs_dirty=''
+ fi
vcs_branch=
;;
darcs)
vcs_dirty=$(darcs whatsnew > /dev/null 2>&1; echo $?)
+ if [[ "$vcs_dirty" -eq 0 ]]; then
+ vcs_dirty='*'
+ else
+ vcs_dirty=''
+ fi
vcs_branch=
;;
git)
@@ -229,10 +239,16 @@ function _set_vcs {
local git_base
git_dir=$(git rev-parse --git-dir)
vcs_branch=$(git symbolic-ref -q HEAD 2>/dev/null)
- if [[ -z "$(git ls-files -udm)" ]]; then
- vcs_dirty=1
+ vcs_dirty=''
+ if git diff --no-ext-diff --ignore-submodules --quiet --exit-code; then
+ :
else
- vcs_dirty=0
+ vcs_dirty="${vcs_dirty}*"
+ fi
+ if git diff-index --cached --quiet --ignore-submodules HEAD; then
+ :
+ else
+ vcs_dirty="${vcs_dirty}+"
fi
if [[ -z "${vcs_branch}" ]]; then
vcs_branch=$(git rev-parse --short HEAD)
@@ -259,11 +275,6 @@ function _set_vcs {
;;
*) return 0 ;;
esac
- if [[ "$vcs_dirty" -eq 0 ]]; then
- vcs_dirty='*'
- else
- vcs_dirty=''
- fi
if [[ -n "$vcs_branch" ]]; then
vcs_branch=":$vcs_branch"
fi
@@ -272,6 +283,8 @@ function _set_vcs {
fi
if [[ "$vcs_local_commits" == "-0" ]]; then
vcs_local_commits=''
+ else
+ vcs_local_commits=":$vcs_local_commits"
fi
__vcs="(${vcs:0:1}${vcs_dirty}${vcs_branch}${vcs_local_commits}${vcs_state})"
}