public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: tsaunders@mozilla.com
To: gcc-patches@gcc.gnu.org
Cc: dnovillo@google.com,	Trevor Saunders <tbsaunde@mozilla.com>
Subject: [PATCH 2/2] allow running mklog as a filter
Date: Tue, 29 Apr 2014 02:16:00 -0000	[thread overview]
Message-ID: <1398737468-6981-3-git-send-email-tsaunders@mozilla.com> (raw)
In-Reply-To: <1398737468-6981-1-git-send-email-tsaunders@mozilla.com>

From: Trevor Saunders <tbsaunde@mozilla.com>

Hi,

I'd like to be able to suggest a git prepare-committ-msg hook, that uses this
at some point to populate the commit message at some point.  This doesn't do
that, but its a step in that direction, what would remain is just writing a
shell script to pipe git diff to mklog and then put the result in the commit
template.  Until that's done this atleast makes it so you don't need to
interact with a diff file at any point.

Trev


2014-04-28  Trevor Saunders
<tbsaunde@mozilla.com>

	* mklog: if reading the patch on stdin write the ChangeLog to stdout.
---
 contrib/mklog | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/contrib/mklog b/contrib/mklog
index 5f5d98e..dfdd2a4 100755
--- a/contrib/mklog
+++ b/contrib/mklog
@@ -277,8 +277,16 @@ foreach my $clname (keys %cl_entries) {
 	print CLFILE "$clname:\n\n$hdrline\n\n$cl_entries{$clname}\n";
 }
 
-# Concatenate the ChangeLog template and the original .diff file.
-system ("cat $diff >>$temp && mv $temp $diff") == 0
-    or die "Could not add the ChangeLog entry to $diff";
+# XXX We should probably accept /dev/stdin or maybe magic autodetection of
+# being supposed to get the patch from stdin.
+#
+# In any case if we got the diff on stdin then write the ChangeLog to stdout.
+if ($diff == "-") {
+	system("cat $temp");
+} else {
+	# Concatenate the ChangeLog template and the original .diff file.
+	system ("cat $diff >>$temp && mv $temp $diff") == 0
+		or die "Could not add the ChangeLog entry to $diff";
+}
 
 exit 0;
-- 
2.0.0.rc0

  parent reply	other threads:[~2014-04-29  2:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-29  2:12 [PATCH 0/2] make using mklog a little nicer tsaunders
2014-04-29  2:13 ` [PATCH 1/2] teach mklog to get name / email from git config when available tsaunders
2014-04-29  5:12   ` Yury Gribov
2014-04-29 10:15     ` Trevor Saunders
2014-04-29 12:27       ` Yury Gribov
2014-04-29 15:47   ` segher
2014-04-29 18:03     ` Trevor Saunders
2014-04-29 23:00       ` Segher Boessenkool
2014-04-29 19:24     ` Peter Bergner
2014-05-09 14:48   ` Diego Novillo
2014-11-20 16:28     ` Tom de Vries
2014-11-20 16:48       ` Segher Boessenkool
2014-11-20 22:34         ` Tom de Vries
2014-11-25 16:09           ` Diego Novillo
2014-04-29  2:16 ` tsaunders [this message]
2014-04-29  8:28   ` [PATCH 2/2] allow running mklog as a filter Yury Gribov
2014-04-29 10:17     ` Trevor Saunders
2014-04-29 12:17       ` Yury Gribov
2014-05-09 15:09       ` Diego Novillo
2014-07-21  8:25         ` Yury Gribov
2014-07-21  9:25           ` Trevor Saunders
2014-07-28  6:47             ` Yury Gribov
2014-07-28 11:17               ` Trevor Saunders
2014-07-28 14:36                 ` Yury Gribov
2014-07-28 14:50                   ` Trevor Saunders

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398737468-6981-3-git-send-email-tsaunders@mozilla.com \
    --to=tsaunders@mozilla.com \
    --cc=dnovillo@google.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tbsaunde@mozilla.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).