3 # Copyright (c) Josef "Jeff" Sipek, 2006-2011
6 USAGE
="[-a|-A] [-c|-C] [-d|-D] [-m|-M] [-r|-R] [-t|-T] [-u|-U] [-x|-X] [-n]"
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking `basename $0` directly is no longer supported." >&2
14 if [ -z "$no_prefix" ] ; then
25 while read status name newname
28 A
*) disp
"$Apfx$name";;
29 C
*) disp
"$Cpfx$name -> $newname";;
30 D
*) disp
"$Dpfx$name";;
31 M
) disp
"$Mpfx$name";;
32 R
*) disp
"$Rpfx$name -> $newname";;
33 T
) disp
"$Tpfx$name";;
34 U
) disp
"$Upfx$name";;
35 ?
) disp
"$Xpfx$name";;
44 while [ $# -gt 0 ]; do
47 DIFF_FILTER
="A$DIFF_FILTER"
50 DIFF_FILTER
="C$DIFF_FILTER"
53 DIFF_FILTER
="D$DIFF_FILTER"
56 DIFF_FILTER
="M$DIFF_FILTER"
59 DIFF_FILTER
="R$DIFF_FILTER"
62 DIFF_FILTER
="T$DIFF_FILTER"
65 DIFF_FILTER
="U$DIFF_FILTER"
69 DIFF_FILTER
="X$DIFF_FILTER"
81 # default status displays all
82 if [ -z "$DIFF_FILTER" ]; then
87 git rev-parse
--verify HEAD
>/dev
/null
2>&1 || IS_INITIAL
=t
91 # untracked; FIXME: there's got to be a better way
92 if [ ! -z "$untracked" ]; then
93 if [ -f "$GIT_DIR/info/exclude" ]; then
94 git ls-files
-z --others \
95 --exclude-from="$GIT_DIR/info/exclude" \
96 --exclude-per-directory=.gitignore
98 git ls-files
-z --others --exclude-per-directory=.gitignore
99 fi |
xargs -0 -L 1 echo |
while read n
; do
100 [ -z "$n" ] && continue
101 echo "$n" |
sed -e "s/^/?\t/"
106 if [ -z "$IS_INITIAL" ]; then
108 git diff-index
-M --name-status --diff-filter=$DIFF_FILTER HEAD
111 git ls-files |
sed -e "s/^/A\t/"