Skip to content

Commit

Permalink
invoke git.exe instead of git in /mnt
Browse files Browse the repository at this point in the history
  • Loading branch information
jenbroek committed Jun 4, 2024
1 parent d76509c commit a98de4b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions templates/.shrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
_PS1() {
local e=${1:-$?} cwd branch stage context
local e=${1:-$?} git=git cwd branch stage context

case $e in
0) cwd='\[\033[38;5;2m\]\w\[\033[m\]' ;;
*) cwd='\[\033[38;5;1m\]\w\[\033[m\]' ;;
esac

branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
case $PWD in
/mnt/*) git=git.exe ;;
esac

branch=$($git rev-parse --abbrev-ref HEAD 2> /dev/null)

if test -n "$branch"; then
git status --porcelain 2> /dev/null | grep -q '^\w' && stage=1
git status --porcelain 2> /dev/null | grep -qv '^\w' && stage=$((stage + 2))
$git status --porcelain 2> /dev/null | grep -q '^\w' && stage=1
$git status --porcelain 2> /dev/null | grep -qv '^\w' && stage=$((stage + 2))

case $stage in
1) stage='\[\033[38;5;12m\]*\[\033[m\]' ;;
Expand Down

0 comments on commit a98de4b

Please sign in to comment.