Ignore empty/commented series lines
[gq.git] / gq-new
blob8f7eea2e29f21b27ac023122f069b92288b0f8c8
1 #!/bin/bash
3 # Copyright (c) Josef "Jeff" Sipek, 2006
6 source "`dirname $0`/gq.lib"
8 patch="$1"
10 if [ -z "$patch" ]; then
11 echo "You must specify a patch name"
12 exit 1
13 else
14 iidx=`wc -l < $applied`
17 # make sure that there are no unapplied changes
18 if ! must_commit_first; then
19 echo "Uncommited changes detected. Refresh first."
20 exit 1
23 # create the empty patch file
24 touch $GQ_DIR/$branch/$patch
26 top=`get_top`
28 if [ ! -z "$top" ]; then
29 sed -i -e "s,^$top\$,$top\n$patch," $series
30 else
31 echo "$patch" > $series.tmp
32 cat $series >> $series.tmp
33 mv $series.tmp $series
36 # apply the patch
37 push_patch $patch
38 echo $patch >> $applied