Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 113 lines (103 sloc) 1.997 kb
#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[-a|-A] [-c|-C] [-d|-D] [-m|-M] [-r|-R] [-t|-T] [-u|-U] [-x|-X] [-n]"
. `dirname $0`/guilt
untracked=""
DIFF_FILTER=""
while [ $# -gt 0 ]; do
case "$1" in
-a|-A)
DIFF_FILTER="A$DIFF_FILTER"
;;
-c|-C)
DIFF_FILTER="C$DIFF_FILTER"
;;
-d|-D)
DIFF_FILTER="D$DIFF_FILTER"
;;
-m|-M)
DIFF_FILTER="M$DIFF_FILTER"
;;
-r|-R)
DIFF_FILTER="R$DIFF_FILTER"
;;
-t|-T)
DIFF_FILTER="T$DIFF_FILTER"
;;
-u|-U)
DIFF_FILTER="U$DIFF_FILTER"
;;
-x|-X)
untracked="t"
DIFF_FILTER="X$DIFF_FILTER"
;;
-n)
no_prefix="t"
;;
*)
usage
;;
esac
shift
done
# default status displays all
if [ -z "$DIFF_FILTER" ]; then
untracked="t"
DIFF_FILTER="ACDMRT"
fi
git rev-parse --verify HEAD >/dev/null 2>&1 || IS_INITIAL=t
print_status()
{
if [ -z "$no_prefix" ] ; then
Apfx="A "
Cpfx="C "
Dpfx="D "
Mpfx="M "
Rpfx="R "
Tpfx="T "
Upfx="U "
Xpfx="? "
fi
while read status name newname
do
case "$status" in
A*) disp "$Apfx$name";;
C*) disp "$Cpfx$name -> $newname";;
D*) disp "$Dpfx$name";;
M ) disp "$Mpfx$name";;
R*) disp "$Rpfx$name -> $newname";;
T ) disp "$Tpfx$name";;
U ) disp "$Upfx$name";;
? ) disp "$Xpfx$name";;
esac
done
}
(
cd_to_toplevel
# untracked; FIXME: there's got to be a better way
if [ ! -z "$untracked" ]; then
if [ -f "$GIT_DIR/info/exclude" ]; then
git ls-files -z --others \
--exclude-from="$GIT_DIR/info/exclude" \
--exclude-per-directory=.gitignore
else
git ls-files -z --others --exclude-per-directory=.gitignore
fi | xargs -0 -L 1 echo | while read n; do
[ -z "$n" ] && continue
echo "$n" | sed -e "s/^/?\t/"
done
fi
# added
if [ -z "$IS_INITIAL" ]; then
# non-initial commit
git diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD
else
# initial commit
git ls-files | sed -e "s/^/A\t/"
fi | sed -e '
s/\\/\\\\/g
s/ /\\ /g
'
) | print_status
Jump to Line
Something went wrong with that request. Please try again.