Add support for SunOS
[guilt/mob.git] / guilt-files
blobe90a8e9496ca92c6105b0b5c96ccdde9046e7f6a
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 top_patch=`get_top`
30 IFS=:
31 if [ -n "$opt_all" ]; then
32 cat $applied
33 else
34 tail -n 1 $applied
35 fi | while read patch; do
36 obj=`git rev-parse refs/patches/$branch/$patch`
38 # shamelessly taken from Quilt(quilt/quilt/files)
39 if [ -n "$opt_all" ] && [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
40 disp "$patch"
42 if [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
43 use_status=yes
46 IFS=' '
48 if [ "$top_patch" != "$patch" ]; then
49 git diff-tree -r $obj^ $obj
50 else
51 git diff-index HEAD^
53 ) | tr '\t' ' '|
54 while read omode nmode osha1 nsha1 st file; do
55 if [ -n "$opt_labels" ]; then
56 if [ -n "$opt_verbose" ]; then
57 _disp "[$patch] "
58 else
59 _disp "$patch "
63 if [ -z "$use_status" ]; then
64 disp "$file"
65 else
66 case $st in
68 status="+" ;;
70 status="-" ;;
72 status=" " ;;
73 esac
75 disp "$status $file"
77 done
78 IFS=:
79 done