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
15 while [ $# -gt 0 ] ; do
25 if [ ! -z "$patch" ]; then
35 if [ -z "$patch" ]; then
37 echo "You must specify a patch name"
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."
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
61 if [ ! -z "$top" ]; then
62 sed -i -e "s,^$top\$,$top\n$patch," $series
64 echo "$patch" > $series.tmp
65 cat $series >> $series.tmp
66 mv $series.tmp
$series