This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH 2/2] allow running mklog as a filter
- From: tsaunders at mozilla dot com
- To: gcc-patches at gcc dot gnu dot org
- Cc: dnovillo at google dot com, Trevor Saunders <tbsaunde at mozilla dot com>
- Date: Mon, 28 Apr 2014 22:11:08 -0400
- Subject: [PATCH 2/2] allow running mklog as a filter
- Authentication-results: sourceware.org; auth=none
- References: <1398737468-6981-1-git-send-email-tsaunders at mozilla dot 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