regression: Fix test descriptions
[guilt.git] / guilt-new
blob01fd58c2cfcdc9783a2a3c7f6815785a5762d806
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt"
8 USAGE="$USAGE [-s] [-m message] <patchname>"
10 if [ $# -lt 1 -o $# -gt 4 ]; then
11 print_usage
12 exit 1
15 while [ $# -gt 0 ] ; do
16 case "$1" in
17 -s)
18 signoff=t
20 -m)
21 msg="$2"
22 shift
25 if [ ! -z "$patch" ]; then
26 print_usage
27 exit 1
29 patch="$1"
31 esac
32 shift
33 done
35 if [ -z "$patch" ]; then
36 print_usage
37 echo "You must specify a patch name"
38 exit 1
41 iidx=`wc -l < $applied`
43 # make sure that there are no unapplied changes
44 if ! must_commit_first; then
45 echo "Uncommited changes detected. Refresh first."
46 exit 1
49 # create any directories as needed
50 [ "`dirname $patch`" != "." ] && mkdir -p `dirname $GUILT_DIR/$branch/$patch`
52 # create the empty patch file
53 touch $GUILT_DIR/$branch/$patch
55 [ ! -z "$msg" ] && echo "$msg" > $GUILT_DIR/$branch/$patch
57 [ "$signoff" = "t" ] && echo -e "\nSigned-off-by: `git-var GIT_COMMITTER_IDENT | sed -e 's/>.*/>/'`" >> $GUILT_DIR/$branch/$patch
59 top=`get_top`
61 if [ ! -z "$top" ]; then
62 sed -i -e "s,^$top\$,$top\n$patch," $series
63 else
64 echo "$patch" > $series.tmp
65 cat $series >> $series.tmp
66 mv $series.tmp $series
69 # apply the patch
70 push_patch $patch