-
Notifications
You must be signed in to change notification settings - Fork 11
/
guilt-files
executable file
·68 lines (61 loc) · 1.12 KB
/
guilt-files
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
#
# Copyright (C) 2007 Yasushi SHOJI <[email protected]>
#
USAGE="[-v] [-a] [-l]"
. guilt
opt_verbose=
opt_all=
opt_labels=
while case "$#" in 0) break ;; esac
do
case "$1" in
-v)
opt_verbose=t ;;
-a)
opt_all=t ;;
-l)
opt_labels=t ;;
*)
usage ;;
esac
shift
done
IFS=:
if [ $opt_all ]; then
cat $applied
else
tail -1 $applied
fi | while read obj patch; do
# shamelessly taken from Quilt(quilt/quilt/files)
if [ -n "$opt_all" ] && [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
echo "$patch"
fi
if [ -n "$opt_verbose" ] && [ -z "$opt_labels" ]; then
use_status=yes
fi
IFS=' '
git diff-tree $obj^ $obj | tr '\t' ' '|
while read omode nmode osha1 nsha1 st file; do
if [ -n "$opt_labels" ]; then
if [ -n "$opt_verbose" ]; then
echo -n "[$patch] "
else
echo -n "$patch "
fi
fi
if [ -z "$use_status" ]; then
echo "$file"
else
status=" "
if [ $osha1 = "0000000000000000000000000000000000000000" ]; then
status="+"
fi
if [ $nsha1 = "0000000000000000000000000000000000000000" ]; then
status="-"
fi
echo "$status $file"
fi
done
IFS=:
done