new: current working dir should not be displayed
[guilt.git] / guilt-files
blobbc06f39df0ad838d0d7a250d1cb7e373f5861b98
1 #!/bin/bash
3 # Copyright (C) 2007 Yasushi SHOJI <yashi@atmark-techno.com>
6 USAGE="[-v] [-a] [-l]"
7 . 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 [ $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