* [GUILT PATCH] guilt-header: Add -e option for editing
@ 2007-07-30 14:34 Eric Lesh
2007-07-30 19:09 ` Josef Sipek
0 siblings, 1 reply; 2+ messages in thread
From: Eric Lesh @ 2007-07-30 14:34 UTC (permalink / raw)
To: Josef Sipek; +Cc: Git mailing list
Signed-off-by: Eric Lesh <eclesh@ucla.edu>
---
| 6 ++++--
guilt | 9 +++++++++
| 20 +++++++++++++++++---
3 files changed, 30 insertions(+), 5 deletions(-)
--git a/Documentation/guilt-header.txt b/Documentation/guilt-header.txt
index ed9ab34..d432959 100644
--- a/Documentation/guilt-header.txt
+++ b/Documentation/guilt-header.txt
@@ -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
------
diff --git a/guilt b/guilt
index f67bfb5..7f2b93c 100755
--- a/guilt
+++ b/guilt
@@ -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()
{
--git a/guilt-header b/guilt-header
index d07e2be..496cb5b 100755
--- a/guilt-header
+++ b/guilt-header
@@ -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
--
1.5.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [GUILT PATCH] guilt-header: Add -e option for editing
2007-07-30 14:34 [GUILT PATCH] guilt-header: Add -e option for editing Eric Lesh
@ 2007-07-30 19:09 ` Josef Sipek
0 siblings, 0 replies; 2+ messages in thread
From: Josef Sipek @ 2007-07-30 19:09 UTC (permalink / raw)
To: Eric Lesh; +Cc: Josef Sipek, Git mailing list
On Mon, Jul 30, 2007 at 07:34:28AM -0700, Eric Lesh wrote:
> Signed-off-by: Eric Lesh <eclesh@ucla.edu>
> ---
> 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.
--
I already backed up the [server] once, I can do it again.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-07-30 19:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-30 14:34 [GUILT PATCH] guilt-header: Add -e option for editing Eric Lesh
2007-07-30 19:09 ` Josef Sipek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).