This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A trivial script to scrub ChangeLog changes from "git show"


I've been writing some automation around testing gcc patches, and kept
running into ChangeLog conflicts, so I wrote the following to make it
easier.

The attached one-liner wraps "git show" into a form that omits changes
to ChangeLog files, for use when generating patches from a git repo,
so that you can run things like:

# Get last commit, omitting ChangeLog changes:
./contrib/git-show-non-changelog.sh

# Get a specific commit, omitting ChangeLog changes:
./contrib/git-show-non-changelog.sh 60623f1616b3144310f432174ebbb3e2cc6dff28

# Get all my non-pushed changes, omitting ChangeLog changes:
./contrib/git-show-non-changelog.sh origin/master..

etc

If there's a pre-existing way of doing this, I'm all ears, naturally [1]

OK for trunk? (and of course, the contrib/ChangeLog entry will no doubt
conflict, irony of ironies).

Dave

[1] gnulib appears to have a "git-merge-changelog", but that requires
building/installing it at the receiving end
commit 120b040899e61ca3b9214bd71a545038025e7e68
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Wed May 22 15:17:35 2013 -0400

    contrib/
    	* git-show-non-changelog.sh: New.

diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 1fd90b7..b0b63f3 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-22  David Malcolm  <dmalcolm@redhat.com>
+
+	* git-show-non-changelog.sh: New.
+
 2013-05-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* config-list.mk (LIST): Add -enable-obsolete for
diff --git a/contrib/git-show-non-changelog.sh b/contrib/git-show-non-changelog.sh
new file mode 100755
index 0000000..5b6ec99
--- /dev/null
+++ b/contrib/git-show-non-changelog.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# "git show OBJECT" but omitting ChangeLog files
+
+# Copyright (C) 2013  Free Software Foundation, Inc.
+# Contributed by David Malcolm <dmalcolm@redhat.com>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+git show $@ $(git show $@ | diffstat -l -p1 | grep -v ChangeLog)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]