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] [-n]"
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"
48 # default status displays all
49 if [ -z "$DIFF_FILTER" ]; then
54 git rev-parse
--verify HEAD
>/dev
/null
2>&1 || IS_INITIAL
=t
58 if [ -z "$no_prefix" ] ; then
69 while read status name newname
72 A
*) disp
"$Apfx$name";;
73 C
*) disp
"$Cpfx$name -> $newname";;
74 D
*) disp
"$Dpfx$name";;
75 M
) disp
"$Mpfx$name";;
76 R
*) disp
"$Rpfx$name -> $newname";;
77 T
) disp
"$Tpfx$name";;
78 U
) disp
"$Upfx$name";;
79 ?
) disp
"$Xpfx$name";;
86 # untracked; FIXME: there's got to be a better way
87 if [ ! -z "$untracked" ]; then
88 if [ -f "$GIT_DIR/info/exclude" ]; then
89 git ls-files
-z --others \
90 --exclude-from="$GIT_DIR/info/exclude" \
91 --exclude-per-directory=.gitignore
93 git ls-files
-z --others --exclude-per-directory=.gitignore
94 fi |
xargs -0 -L 1 echo |
while read n
; do
95 [ -z "$n" ] && continue
96 echo "$n" |
sed -e "s/^/?\t/"
101 if [ -z "$IS_INITIAL" ]; then
103 git diff-index
-M --name-status --diff-filter=$DIFF_FILTER HEAD
106 git ls-files |
sed -e "s/^/A\t/"