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 if [ -f "$GUILT_DIR/$branch/$patch" ]; then
55 echo "patch '$patch' already exist" >&2
59 iidx
=`wc -l < $applied`
61 # make sure that there are no unapplied changes
62 if ! must_commit_first
; then
63 echo "Uncommited changes detected. Refresh first."
67 # create any directories as needed
68 [ "`dirname $patch`" != "." ] && mkdir
-p `dirname $GUILT_DIR/$branch/$patch`
70 # create the file with the right contents
72 # did we get a message with -m ?
73 [ ! -z "$msg" ] && echo "$msg"
75 # add a sign-off-by (-s)
76 [ "$signoff" = "t" ] && echo -e "\nSigned-off-by: `git-var GIT_COMMITTER_IDENT | sed -e 's/>.*/>/'`"
77 ) >> $GUILT_DIR/$branch/$patch
80 [ "$edit" = "t" ] && $editor $GUILT_DIR/$branch/$patch
82 # insert the patch name into the series file
83 series_insert_patch
$patch