]> git.phdru.name Git - git-scripts.git/blob - git-status.sh
Feat(submodules/remove): Add option `-c`
[git-scripts.git] / git-status.sh
1 #! /bin/sh
2
3 STMP="$HOME"/tmp/git-status.tmp
4 export STMP
5 trap 'exec rm -rf "$STMP"' 0 HUP INT QUIT TERM
6 rm -rf "$STMP" && mkdir "$STMP" &&
7
8 GIT_INDEX_FILE="$STMP"/index &&
9 export GIT_INDEX_FILE &&
10
11 GIT_DIR="`git rev-parse --git-dir`"
12 if [ -d "$GIT_DIR" -a -f "$GIT_DIR"/index ]; then
13    cp -p "$GIT_DIR"/index $GIT_INDEX_FILE
14 else
15    echo "$0: `pwd` is not a git repository/worktree" >&2
16    exit 1
17 fi &&
18
19 git status "$@" &&
20 exec rm -rf "$STMP"