X-Git-Url: https://git.phdru.name/?p=git-scripts.git;a=blobdiff_plain;f=git-status.sh;h=2b33f404b2604e5982fc793347ee1db8ee84ab0d;hp=ddab464dc29229bf211de19e5bb59de0debb3636;hb=b90789d369c5500fa85a0954869626e8aa3566ce;hpb=646d28a9e550d907fd8353527aaaa7d87b365e76 diff --git a/git-status.sh b/git-status.sh index ddab464..2b33f40 100755 --- a/git-status.sh +++ b/git-status.sh @@ -8,10 +8,11 @@ rm -rf "$STMP" && mkdir "$STMP" && GIT_INDEX_FILE="$STMP"/index && export GIT_INDEX_FILE && -if [ -d .git -a -f .git/index ]; then - cp -p .git/index $GIT_INDEX_FILE +GIT_DIR="`git rev-parse --git-dir`" +if [ -d "$GIT_DIR" -a -f "$GIT_DIR"/index ]; then + cp -p "$GIT_DIR"/index $GIT_INDEX_FILE else - echo "$0: `pwd` is not a git directory" >&2 + echo "$0: `pwd` is not a git repository/worktree" >&2 exit 1 fi &&