guilt: check status file for being old format
[guilt/mob.git] / guilt-files
blobd37832754ec18b4f242cb265788243a2dd78c3c2
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 patch; do
34 obj=`git rev-parse refs/patches/$branch/$patch`
36 # shamelessly taken from Quilt(quilt/quilt/files)
37 if [ -n "$opt_all" ] && [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
38 echo "$patch"
40 if [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
41 use_status=yes
44 IFS=' '
45 git diff-tree -r $obj^ $obj | tr '\t' ' '|
46 while read omode nmode osha1 nsha1 st file; do
47 if [ -n "$opt_labels" ]; then
48 if [ -n "$opt_verbose" ]; then
49 echo -n "[$patch] "
50 else
51 echo -n "$patch "
55 if [ -z "$use_status" ]; then
56 echo "$file"
57 else
58 status=" "
59 if [ $osha1 = "0000000000000000000000000000000000000000" ]; then
60 status="+"
62 if [ $nsha1 = "0000000000000000000000000000000000000000" ]; then
63 status="-"
65 echo "$status $file"
67 done
68 IFS=:
69 done