Merge pull request #38 from ogr3/master

Associative arrays does not work on Bash 3 (OS X for instance). Change t...
master
Martin Gondermann 12 years ago
commit 74beec2a7f
  1. 13
      gitstatus.sh

@ -6,10 +6,9 @@
# Alan K. Stebbens <aks@stebbens.org> [http://github.com/aks] # Alan K. Stebbens <aks@stebbens.org> [http://github.com/aks]
# change those symbols to whatever you prefer # change those symbols to whatever you prefer
declare -a symbols symbols_ahead='↑·'
symbols['ahead']='↑·' symbols_behind='↓·'
symbols['behind']='↓·' symbols_prehash=':'
symbols['prehash']=':'
gitsym=`git symbolic-ref HEAD` gitsym=`git symbolic-ref HEAD`
@ -52,7 +51,7 @@ if [[ -z "$branch" ]]; then
if [[ -n "$tag" ]]; then if [[ -n "$tag" ]]; then
branch="$tag" branch="$tag"
else else
branch="${symbols['prehash']}`git rev-parse --short HEAD`" branch="${symbols_prehash}`git rev-parse --short HEAD`"
fi fi
else else
remote_name=`git config branch.${branch}.remote` remote_name=`git config branch.${branch}.remote`
@ -73,10 +72,10 @@ else
num_ahead=`count_lines "^>"` num_ahead=`count_lines "^>"`
num_behind=$(( num_revs - num_ahead )) num_behind=$(( num_revs - num_ahead ))
if (( num_behind > 0 )) ; then if (( num_behind > 0 )) ; then
remote="${remote}${symbols['behind']}${num_behind}" remote="${remote}${symbols_behind}${num_behind}"
fi fi
if (( num_ahead > 0 )) ; then if (( num_ahead > 0 )) ; then
remote="${remote}${symbols['ahead']}${num_ahead}" remote="${remote}${symbols_ahead}${num_ahead}"
fi fi
fi fi
if [[ -z "$remote" ]] ; then if [[ -z "$remote" ]] ; then

Loading…
Cancel
Save