3 # Copyright (c) Josef "Jeff" Sipek, 2006-2011
6 USAGE
="[-eE] [<patchname>]"
7 if [ -z "$GUILT_VERSION" ]; then
8 echo "Invoking `basename $0` directly is no longer supported." >&2
19 if [ "$1" = "-e" ]; then
22 elif [ "$1" = "-E" ]; then
31 if [ "$1" = "-e" ]; then
34 elif [ "$1" = "-E" ]; then
44 # are there any patches applied?
45 [ -z "$patch" ] && die
"No patches applied."
47 # check that patch exists in the series
48 ret
=`get_full_series | grep -e "^$patch\$" | wc -l`
49 if [ $ret -eq 0 ]; then
50 die
"Patch $patch is not in the series"
53 # FIXME: warn if we're editing an applied patch
55 TMP_MSG
=`get_tmp_file msg`
56 TMP_DIFF
=`get_tmp_file diff`
58 if [ -z "$edit" ]; then
59 do_get_header
"$GUILT_DIR/$branch/$patch"
61 if [ -n "$full" ]; then
62 git_editor
"$GUILT_DIR/$branch/$patch"
65 do_get_full_header
"$GUILT_DIR/$branch/$patch" > "$TMP_MSG"
66 do_get_patch
"$GUILT_DIR/$branch/$patch" > "$TMP_DIFF"
68 mv "$GUILT_DIR/$branch/$patch" "$GUILT_DIR/$branch/$patch~"
73 ) > "$GUILT_DIR/$branch/$patch"
76 rm -f "$TMP_MSG" "$TMP_DIFF"