diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2009-11-07 01:23:32 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2009-11-07 01:23:32 (GMT) |
commit | 0775c9fc10e1128334763f516342d6b312508ef5 (patch) | |
tree | dc199415c174427f130df23a9fb6907e072ccf60 /tools | |
parent | 48ec125cf19a441fce80ad9bf3687a4e52761345 (diff) | |
download | monitoring-plugins-0775c9fc10e1128334763f516342d6b312508ef5.tar.gz |
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).
Diffstat (limited to 'tools')
-rwxr-xr-x | 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 @@ | |||
15 | # | 15 | # |
16 | # Usage: git-notify [options] [--] old-sha1 new-sha1 refname | 16 | # Usage: git-notify [options] [--] old-sha1 new-sha1 refname |
17 | # | 17 | # |
18 | # -C Show committer in the body if different from the author | ||
18 | # -c name Send CIA notifications under specified project name | 19 | # -c name Send CIA notifications under specified project name |
19 | # -m addr Send mail notifications to specified address | 20 | # -m addr Send mail notifications to specified address |
20 | # -n max Set max number of individual mails to send | 21 | # -n max Set max number of individual mails to send |
@@ -49,6 +50,9 @@ my $debug = 0; | |||
49 | 50 | ||
50 | # configuration parameters | 51 | # configuration parameters |
51 | 52 | ||
53 | # show the committer if different from the author (can be set with the -C option) | ||
54 | my $show_committer = git_config( "notify.showcommitter" ); | ||
55 | |||
52 | # base URL of the gitweb repository browser (can be set with the -u option) | 56 | # base URL of the gitweb repository browser (can be set with the -u option) |
53 | my $gitweb_url = git_config( "notify.baseurl" ); | 57 | my $gitweb_url = git_config( "notify.baseurl" ); |
54 | 58 | ||
@@ -85,6 +89,7 @@ my @revlist_options; | |||
85 | sub usage() | 89 | sub usage() |
86 | { | 90 | { |
87 | print "Usage: $0 [options] [--] old-sha1 new-sha1 refname\n"; | 91 | print "Usage: $0 [options] [--] old-sha1 new-sha1 refname\n"; |
92 | print " -C Show committer in the body if different from the author\n"; | ||
88 | print " -c name Send CIA notifications under specified project name\n"; | 93 | print " -c name Send CIA notifications under specified project name\n"; |
89 | print " -m addr Send mail notifications to specified address\n"; | 94 | print " -m addr Send mail notifications to specified address\n"; |
90 | print " -n max Set max number of individual mails to send\n"; | 95 | print " -n max Set max number of individual mails to send\n"; |
@@ -265,6 +270,7 @@ sub parse_options() | |||
265 | my $arg = shift @ARGV; | 270 | my $arg = shift @ARGV; |
266 | 271 | ||
267 | if ($arg eq '--') { last; } | 272 | if ($arg eq '--') { last; } |
273 | elsif ($arg eq '-C') { $show_committer = 1; } | ||
268 | elsif ($arg eq '-c') { $cia_project_name = shift @ARGV; } | 274 | elsif ($arg eq '-c') { $cia_project_name = shift @ARGV; } |
269 | elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; } | 275 | elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; } |
270 | elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; } | 276 | elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; } |
@@ -432,7 +438,7 @@ sub send_commit_notice($$) | |||
432 | "Branch: $ref", | 438 | "Branch: $ref", |
433 | "Commit: $obj", | 439 | "Commit: $obj", |
434 | "Author:" . $info{"author"}, | 440 | "Author:" . $info{"author"}, |
435 | $info{"committer"} ne $info{"author"} ? "Committer:" . $info{"committer"} : undef, | 441 | $show_committer && $info{"committer"} ne $info{"author"} ? "Committer:" . $info{"committer"} : undef, |
436 | "Date:" . format_date($info{"author_date"},$info{"author_tz"}), | 442 | "Date:" . format_date($info{"author_date"},$info{"author_tz"}), |
437 | $url ? "URL: $url" : undef), | 443 | $url ? "URL: $url" : undef), |
438 | "", | 444 | "", |