]> git.donarmstrong.com Git - zsh.git/blobdiff - .zsh/func/vcsh
fix use of $0
[zsh.git] / .zsh / func / vcsh
index e404efcc62e61f2140b9df7d7dcca71a37b4d848..655c9ea3290ae06fdb02d25e453468f60a16fa10 100755 (executable)
 # Source repository: http://git.madduck.net/v/etc/zsh.git
 #
 
-FGIT_BASE="$HOME/.fgits"
+local FGIT_BASE="$HOME/.fgits"
 
 if [ "${1:---help}" = '--help' ] || [ $# -gt 1 ]; then
-  echo "usage: ${0%/*} reponame" >&2
-  echo "usage: ${0%/*} -l" >&2
+  echo "usage: ${0##*/} reponame" >&2
+  echo "usage: ${0##*/} -l" >&2
   [ "$1" = '--help' ]
   return $?
 
@@ -31,7 +31,11 @@ if [ ! -d "$FGIT_BASE/${1}.git" ]; then
   return 2
 fi
 
-export GIT_DIR=$FGIT_BASE/${1}.git
+export GIT_DIR="$FGIT_BASE/${1}.git"
+local _WORKTREE="$(git config --get core.worktree)"
+export GIT_WORK_TREE="$(readlink -f $GIT_DIR/$_WORKTREE)"
+unset _WORKTREE
+
 git status
 
-PS1="%S{VCSH:$1}%s$PS1" $SHELL -i
+PS1="%S{${0##*/}:$1}%s$PS1" $SHELL -i