guilt-header: Add -e option for editing
PATCH 1/1 guilt-header: Add -e option for editing
Signed-off-by Eric Lesh <[email protected]>
--- Documentation/guilt-header.txt | 6 ++++-- guilt | 9 +++++++++ guilt-header | 20 +++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-)
Documentation/guilt-header.txt +4 -2
@@ -11,10 +11,12 @@ include::usage-guilt-header.txt[] DESCRIPTION ----------- -Prints either the topmost patches' header or the header of a specified patch. +Prints either the topmost patch's header or the header of a specified patch. +-e:: + Open the header in an editor, instead of printing it. <patchname>:: - Name of the patch. + Name of the patch. Author ------
guilt +9 -0
@@ -209,6 +209,15 @@ do_make_header() ' } +# usage: do_get_patch patchfile +do_get_patch() +{ + cat "$1" | awk ' +BEGIN{} +/^(diff|---)/,/END{}/ +' +} + # usage: do_get_header patchfile do_get_header() {
guilt-header +17 -3
@@ -3,13 +3,18 @@ # Copyright (c) Josef "Jeff" Sipek, 2006, 2007 # -USAGE="[<patchname>]" +USAGE="[-e] [<patchname>]" . `dirname $0`/guilt -if [ $# -gt 1 ]; then +if [ $# -gt 2 ]; then usage fi +if [ "$1" = "-e" ]; then + edit=t + shift +fi + patch="$1" if [ -z "$patch" ]; then
@@ -34,6 +39,15 @@ for p in `get_series`; do [ $idx -lt $eidx ] && continue [ $idx -gt $eidx ] && break - do_get_header $GUILT_DIR/$branch/$p + if [ -z "$edit" ]; then + do_get_header $GUILT_DIR/$branch/$p + else + do_get_full_header $GUILT_DIR/$branch/$p > /tmp/guilt.msg.$$ + do_get_patch $GUILT_DIR/$branch/$p > /tmp/guilt.diff.$$ + $editor "/tmp/guilt.msg.$$" + mv $GUILT_DIR/$branch/$p $GUILT_DIR/$branch/$p~ + cat /tmp/guilt.msg.$$ > $GUILT_DIR/$branch/$p + cat /tmp/guilt.diff.$$ >> $GUILT_DIR/$branch/$p + fi done
Signature · 1 line
1.5.2
Josef Sipek
AppliedQuoted 6 lines · Eric Lesh
Signed-off-by Eric Lesh <[email protected]>--- Documentation/guilt-header.txt | 6 ++++-- guilt | 9 +++++++++ guilt-header | 20 +++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-)
Applied. Right after applying your patch, I decided to clean things up a bit. This includes removal of the scan of the series => not needed as we already know the patch name anyway.
Thanks,
Josef 'Jeff' Sipek.
Signature · 1 line
I already backed up the [server] once, I can do it again.