doc: we no longer support guilt-foo invocation
[guilt.git] / guilt-files
blob6428d2b4ec3bc97bec54570248bb5d3eafb54002
1 #!/bin/sh
3 # Copyright (C) 2007 Yasushi SHOJI <yashi@atmark-techno.com>
6 USAGE="[-v] [-a] [-l]"
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking `basename "$0"` directly is no longer supported." >&2
9 exit 1
12 _main() {
14 opt_verbose=
15 opt_all=
16 opt_labels=
18 while case "$#" in 0) break ;; esac
20 case "$1" in
21 -v)
22 opt_verbose=t ;;
23 -a)
24 opt_all=t ;;
25 -l)
26 opt_labels=t ;;
28 usage ;;
29 esac
30 shift
31 done
33 top_patch=`get_top`
35 IFS=:
36 if [ -n "$opt_all" ]; then
37 cat "$applied"
38 else
39 tail -n 1 "$applied"
40 fi | while read patch; do
41 obj=`git rev-parse refs/patches/$branch/$patch`
43 # shamelessly taken from Quilt(quilt/quilt/files)
44 if [ -n "$opt_all" ] && [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
45 disp "$patch"
47 if [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
48 use_status=yes
51 IFS=' '
53 if [ "$top_patch" != "$patch" ]; then
54 git diff-tree -r $obj^ $obj
55 else
56 git diff-index HEAD^
58 ) | tr '\t' ' '|
59 while read omode nmode osha1 nsha1 st file; do
60 if [ -n "$opt_labels" ]; then
61 if [ -n "$opt_verbose" ]; then
62 _disp "[$patch] "
63 else
64 _disp "$patch "
68 if [ -z "$use_status" ]; then
69 disp "$file"
70 else
71 case $st in
73 status="+" ;;
75 status="-" ;;
77 status=" " ;;
78 esac
80 disp "$status $file"
82 done
83 IFS=:
84 done