diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2009-11-07 02:23:32 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2009-11-07 02:23:32 +0100 |
commit | 366d102dbaa1d8c8569ba0a01a61ca1e8ce201db (patch) | |
tree | 4bfc79b5cf934bd60422d9b0379ec1156d7aac41 /tools | |
parent | 40ef91694655a3abb425d994a1b862f956ac081c (diff) | |
download | monitoring-plugins-366d102dbaa1d8c8569ba0a01a61ca1e8ce201db.tar.gz |
git-notify: Optionally omit the author name
If the new "-A" option is specified (or "notify.omitAuthor" is set), the
author name will be omitted from the subject of e-mail notifications.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/git-notify | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/git-notify b/tools/git-notify index 289a5f64..e5094b41 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 | # -A Omit the author name from the mail subject | ||
18 | # -C Show committer in the body if different from the author | 19 | # -C Show committer in the body if different from the author |
19 | # -c name Send CIA notifications under specified project name | 20 | # -c name Send CIA notifications under specified project name |
20 | # -m addr Send mail notifications to specified address | 21 | # -m addr Send mail notifications to specified address |
@@ -51,6 +52,9 @@ my $debug = 0; | |||
51 | 52 | ||
52 | # configuration parameters | 53 | # configuration parameters |
53 | 54 | ||
55 | # omit the author from the mail subject (can be set with the -A option) | ||
56 | my $omit_author = git_config( "notify.omitauthor" ); | ||
57 | |||
54 | # show the committer if different from the author (can be set with the -C option) | 58 | # show the committer if different from the author (can be set with the -C option) |
55 | my $show_committer = git_config( "notify.showcommitter" ); | 59 | my $show_committer = git_config( "notify.showcommitter" ); |
56 | 60 | ||
@@ -93,6 +97,7 @@ my @revlist_options; | |||
93 | sub usage() | 97 | sub usage() |
94 | { | 98 | { |
95 | print "Usage: $0 [options] [--] old-sha1 new-sha1 refname\n"; | 99 | print "Usage: $0 [options] [--] old-sha1 new-sha1 refname\n"; |
100 | print " -A Omit the author name from the mail subject\n"; | ||
96 | print " -C Show committer in the body if different from the author\n"; | 101 | print " -C Show committer in the body if different from the author\n"; |
97 | print " -c name Send CIA notifications under specified project name\n"; | 102 | print " -c name Send CIA notifications under specified project name\n"; |
98 | print " -m addr Send mail notifications to specified address\n"; | 103 | print " -m addr Send mail notifications to specified address\n"; |
@@ -275,6 +280,7 @@ sub parse_options() | |||
275 | my $arg = shift @ARGV; | 280 | my $arg = shift @ARGV; |
276 | 281 | ||
277 | if ($arg eq '--') { last; } | 282 | if ($arg eq '--') { last; } |
283 | elsif ($arg eq '-A') { $omit_author = 1; } | ||
278 | elsif ($arg eq '-C') { $show_committer = 1; } | 284 | elsif ($arg eq '-C') { $show_committer = 1; } |
279 | elsif ($arg eq '-c') { $cia_project_name = shift @ARGV; } | 285 | elsif ($arg eq '-c') { $cia_project_name = shift @ARGV; } |
280 | elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; } | 286 | elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; } |
@@ -437,7 +443,8 @@ sub send_commit_notice($$) | |||
437 | "", | 443 | "", |
438 | join "\n", @{$info{"log"}}; | 444 | join "\n", @{$info{"log"}}; |
439 | 445 | ||
440 | $subject = "Tag " . $info{"tag"} . ": " . $info{"tagger_name"}; | 446 | $subject = "Tag " . $info{"tag"} . ": "; |
447 | $subject .= $info{"tagger_name"} . ": " unless $omit_author; | ||
441 | } | 448 | } |
442 | else | 449 | else |
443 | { | 450 | { |
@@ -471,10 +478,10 @@ sub send_commit_notice($$) | |||
471 | { | 478 | { |
472 | push @notice, "Diff: $gitweb_url/?a=commitdiff;h=$obj_string" if $gitweb_url; | 479 | push @notice, "Diff: $gitweb_url/?a=commitdiff;h=$obj_string" if $gitweb_url; |
473 | } | 480 | } |
474 | $subject = $info{"author_name"}; | 481 | $subject = $info{"author_name"} . ": " unless $omit_author; |
475 | } | 482 | } |
476 | 483 | ||
477 | $subject .= ": " . truncate_str(${$info{"log"}}[0],50); | 484 | $subject .= truncate_str(${$info{"log"}}[0],50); |
478 | $_ = decode($info{"encoding"}, $_) for @notice; | 485 | $_ = decode($info{"encoding"}, $_) for @notice; |
479 | mail_notification($commitlist_address, $subject, "text/plain; charset=UTF-8", @notice); | 486 | mail_notification($commitlist_address, $subject, "text/plain; charset=UTF-8", @notice); |
480 | } | 487 | } |