-
Notifications
You must be signed in to change notification settings - Fork 11
/
guilt-series
executable file
·66 lines (58 loc) · 1.21 KB
/
guilt-series
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
#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006-2013
#
USAGE="[-v | -g | -e]"
if [ -z "$GUILT_VERSION" ]; then
echo "Invoking `basename "$0"` directly is no longer supported." >&2
exit 1
fi
_main() {
while case "$#" in 0) break ;; esac
do
case "$1" in
-v)
verbose=t ;;
-g)
gui=t ;;
-e)
edit=t ;;
*)
usage ;;
esac
shift
done
if [ ! -z "$edit" ]; then
git_editor "$series"
elif [ ! -z "$gui" ]; then
[ -z "`get_top`" ] && die "No patches applied."
bottom=`git rev-parse refs/patches/$branch/$(head_n 1 "$applied")`
top=`git rev-parse refs/patches/$branch/$(tail -n 1 "$applied")`
range="$bottom..$top"
# FIXME, this doesn't quite work - it's perfectly fine with
# "git rev-list", but gitk for whatever reason likes to include the
# parent
[ "$bottom" = "$top" ] && range="$bottom^..$bottom"
gitk $range
elif [ -z "$verbose" ]; then
get_full_series
else
prefix="+"
top=`get_top`
get_full_series |
while read patch; do
if [ -z "$top" ]; then
disp " $patch"
else
if [ "$patch" = "$top" ]; then
disp "= $patch"
prefix=" "
elif [ $(check_guards "$patch"; echo $?) -eq 1 ]; then
echo " $patch"
else
disp "$prefix $patch"
fi
fi
done
fi
}