[nagiosplug] git-notify: Make showing the committer optional

"Holger Weiss" <[email protected]>
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
 Module: nagiosplug
 Branch: master
 Commit: 0775c9fc10e1128334763f516342d6b312508ef5
 Author: Holger Weiss <[email protected]>
   Date: Sat Nov  7 02:23:32 2009 +0100
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=0775c9f

git-notify: Make showing the committer optional

Only the author's name and address will now be mentioned in a commit
notification by default.  However, if the "-C" option is specified (or
"notify.showCommitter" is set), the committer's name and address will
also be included in the notification if the committer is not the author
of the commit (as we previously did by default).

---

 tools/git-notify |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/tools/git-notify b/tools/git-notify
index c68ed09..0031fcd 100755
--- a/tools/git-notify
+++ b/tools/git-notify
@@ -15,6 +15,7 @@
 #
 # Usage: git-notify [options] [--] old-sha1 new-sha1 refname
 #
+#   -C        Show committer in the body if different from the author
 #   -c name   Send CIA notifications under specified project name
 #   -m addr   Send mail notifications to specified address
 #   -n max    Set max number of individual mails to send
@@ -49,6 +50,9 @@ my $debug = 0;
 
 # configuration parameters
 
+# show the committer if different from the author (can be set with the -C option)
+my $show_committer = git_config( "notify.showcommitter" );
+
 # base URL of the gitweb repository browser (can be set with the -u option)
 my $gitweb_url = git_config( "notify.baseurl" );
 
@@ -85,6 +89,7 @@ my @revlist_options;
 sub usage()
 {
     print "Usage: $0 [options] [--] old-sha1 new-sha1 refname\n";
+    print "   -C        Show committer in the body if different from the author\n";
     print "   -c name   Send CIA notifications under specified project name\n";
     print "   -m addr   Send mail notifications to specified address\n";
     print "   -n max    Set max number of individual mails to send\n";
@@ -265,6 +270,7 @@ sub parse_options()
         my $arg = shift @ARGV;
 
         if ($arg eq '--') { last; }
+        elsif ($arg eq '-C') { $show_committer = 1; }
         elsif ($arg eq '-c') { $cia_project_name = shift @ARGV; }
         elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; }
         elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; }
@@ -432,7 +438,7 @@ sub send_commit_notice($$)
           "Branch: $ref",
           "Commit: $obj",
           "Author:" . $info{"author"},
-          $info{"committer"} ne $info{"author"} ? "Committer:" . $info{"committer"} : undef,
+          $show_committer && $info{"committer"} ne $info{"author"} ? "Committer:" . $info{"committer"} : undef,
           "Date:" . format_date($info{"author_date"},$info{"author_tz"}),
           $url ? "URL: $url" : undef),
           "",


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.