[PATCH] Allow command abbreviation
[guilt.git] / guilt-header
blob45f61832dfe4e6a36125ee37a12b8df69598468c
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt"
8 USAGE="$USAGE [<patchname>]"
10 if [ $# -gt 1 ]; then
11 print_usage
12 exit 1
15 patch="$1"
17 if [ -z "$patch" ]; then
18 # use the patch that's on the top of the stack
20 eidx=`wc -l < $applied`
21 if [ $eidx -eq 0 ]; then
22 echo "Status file is empty"
23 exit 1
25 else
26 # use the specified patch
28 eidx=`get_series | grep -ne "^$patch\$" | cut -d: -f1`
29 if [ $eidx -eq 0 ]; then
30 echo "Patch $patch is not in the series"
31 exit 1
35 idx=0
36 for p in `get_series`; do
37 idx=`expr $idx + 1`
38 [ $idx -lt $eidx ] && continue
39 [ $idx -gt $eidx ] && break
41 do_get_header $GUILT_DIR/$branch/$p
42 done