3 # Copyright (c) Josef "Jeff" Sipek, 2006, 2007
6 source "`dirname $0`/guilt"
8 USAGE
="$USAGE [-s] [-e|-m message] <patchname>"
10 if [ $# -lt 1 -o $# -gt 4 ]; then
15 while [ $# -gt 0 ] ; do
23 if [ ! -z "$msg" ]; then
32 if [ ! -z "$edit" ]; then
38 if [ ! -z "$patch" ]; then
48 if [ -z "$patch" ]; then
50 echo "You must specify a patch name"
54 iidx
=`wc -l < $applied`
56 # make sure that there are no unapplied changes
57 if ! must_commit_first
; then
58 echo "Uncommited changes detected. Refresh first."
62 # create any directories as needed
63 [ "`dirname $patch`" != "." ] && mkdir
-p `dirname $GUILT_DIR/$branch/$patch`
65 # create the file with the right contents
67 # did we get a message with -m ?
68 [ ! -z "$msg" ] && echo "$msg"
70 # add a sign-off-by (-s)
71 [ "$signoff" = "t" ] && echo -e "\nSigned-off-by: `git-var GIT_COMMITTER_IDENT | sed -e 's/>.*/>/'`"
72 ) >> $GUILT_DIR/$branch/$patch
75 [ "$edit" = "t" ] && $editor $GUILT_DIR/$branch/$patch
79 if [ ! -z "$top" ]; then
80 sed -i -e "s,^$top\$,$top\n$patch," $series
82 echo "$patch" > $series.tmp
83 cat $series >> $series.tmp
84 mv $series.tmp
$series