branch: fix a regression (refs not being copied)
[guilt.git] / guilt-series
blob7d8f8e9d1ef5be0f80e42d72bceb0ffa17adbaf0
1 #!/bin/sh
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 USAGE="[-v | -g | -e]"
7 . `dirname $0`/guilt
9 while case "$#" in 0) break ;; esac
11 case "$1" in
12 -v)
13 verbose=t ;;
14 -g)
15 gui=t ;;
16 -e)
17 edit=t ;;
19 usage ;;
20 esac
21 shift
22 done
24 if [ ! -z "$edit" ]; then
25 $editor "$series"
26 elif [ ! -z "$gui" ]; then
27 [ -z "`get_top`" ] && die "No patches applied."
28 bottom=`git rev-parse refs/patches/$branch/$(head -1 $applied)`
29 top=`git rev-parse refs/patches/$branch/$(tail -1 $applied)`
30 range="$bottom..$top"
32 # FIXME, this doesn't quite work - it's perfectly fine with
33 # "git rev-list", but gitk for whatever reason likes to include the
34 # parent
35 [ "$bottom" = "$top" ] && range="$bottom^..$bottom"
37 gitk $range
38 elif [ -z "$verbose" ]; then
39 get_series
40 else
41 prefix="+"
42 top=`get_top`
44 get_series |
45 while read patch; do
46 if [ -z "$top" ]; then
47 disp " $patch"
48 else
49 if [ "$patch" = "$top" ]; then
50 disp "= $patch"
51 prefix=" "
52 else
53 disp "$prefix $patch"
56 done