regression: test 026: test delete code
[guilt.git] / guilt-files
blob3428be494a9c20f2045fb1d3f2dd78903ceaf42c
1 #!/bin/sh
3 # Copyright (C) 2007 Yasushi SHOJI <yashi@atmark-techno.com>
6 USAGE="[-v] [-a] [-l]"
7 . `dirname $0`/guilt
9 opt_verbose=
10 opt_all=
11 opt_labels=
13 while case "$#" in 0) break ;; esac
15 case "$1" in
16 -v)
17 opt_verbose=t ;;
18 -a)
19 opt_all=t ;;
20 -l)
21 opt_labels=t ;;
23 usage ;;
24 esac
25 shift
26 done
28 IFS=:
29 if [ -n "$opt_all" ]; then
30 cat $applied
31 else
32 tail -1 $applied
33 fi | while read obj patch; do
34 # shamelessly taken from Quilt(quilt/quilt/files)
35 if [ -n "$opt_all" ] && [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
36 echo "$patch"
38 if [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
39 use_status=yes
42 IFS=' '
43 git-diff-tree -r $obj^ $obj | tr '\t' ' '|
44 while read omode nmode osha1 nsha1 st file; do
45 if [ -n "$opt_labels" ]; then
46 if [ -n "$opt_verbose" ]; then
47 echo -n "[$patch] "
48 else
49 echo -n "$patch "
53 if [ -z "$use_status" ]; then
54 echo "$file"
55 else
56 status=" "
57 if [ $osha1 = "0000000000000000000000000000000000000000" ]; then
58 status="+"
60 if [ $nsha1 = "0000000000000000000000000000000000000000" ]; then
61 status="-"
63 echo "$status $file"
65 done
66 IFS=:
67 done