3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 USAGE
="[-a|-A] [-c|-C] [-d|-D] [-m|-M] [-r|-R] [-t|-T] [-u|-U] [-x|-X]"
11 while [ $# -gt 0 ]; do
14 DIFF_FILTER
="A$DIFF_FILTER"
17 DIFF_FILTER
="C$DIFF_FILTER"
20 DIFF_FILTER
="D$DIFF_FILTER"
23 DIFF_FILTER
="M$DIFF_FILTER"
26 DIFF_FILTER
="R$DIFF_FILTER"
29 DIFF_FILTER
="T$DIFF_FILTER"
32 DIFF_FILTER
="U$DIFF_FILTER"
36 DIFF_FILTER
="X$DIFF_FILTER"
45 # default status displays all
46 if [ -z "$DIFF_FILTER" ]; then
51 git-rev-parse
--verify HEAD
>/dev
/null
2>&1 || IS_INITIAL
=t
55 while read status name newname
59 C
*) echo "C $name -> $newname";;
62 R
*) echo "R $name -> $newname";;
71 # untracked; FIXME: there's got to be a better way
72 if [ ! -z "$untracked" ]; then
73 if [ -f "$GIT_DIR/info/exclude" ]; then
74 git-ls-files
-z --others \
75 --exclude-from="$GIT_DIR/info/exclude" \
76 --exclude-per-directory=.gitignore
78 git-ls-files
-z --others --exclude-per-directory=.gitignore
79 fi |
xargs -0 -L 1 echo |
while read n
; do
80 [ -z "$n" ] && continue
81 echo "$n" |
sed -e "s/^/?\t/"
86 if [ -z "$IS_INITIAL" ]; then
88 git-diff-index
-M --name-status --diff-filter=$DIFF_FILTER HEAD
91 git-ls-files |
sed -e "s/^/A\t/"