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 | d100429a4816da68f65c2a5be291e7ae7beb5e17 (patch) | |
tree | f1ce637d350c1e9fa1710a59d36db2b2159a9fdd /tools/git-notify | |
parent | 366d102dbaa1d8c8569ba0a01a61ca1e8ce201db (diff) | |
download | monitoring-plugins-d100429a4816da68f65c2a5be291e7ae7beb5e17.tar.gz |
git-notify: Optionally [tag] the subject
If the new "-T" option is specified or "notify.emitRepository" is set,
the subject of e-mail notifications will be prefixed with [<tag>], where
<tag> is the name of the updated repository.
Diffstat (limited to 'tools/git-notify')
-rwxr-xr-x | tools/git-notify | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/git-notify b/tools/git-notify index e5094b4..8ade7b8 100755 --- a/tools/git-notify +++ b/tools/git-notify | |||
@@ -22,6 +22,7 @@ | |||
22 | # -n max Set max number of individual mails to send | 22 | # -n max Set max number of individual mails to send |
23 | # -r name Set the git repository name | 23 | # -r name Set the git repository name |
24 | # -s bytes Set the maximum diff size in bytes (-1 for no limit) | 24 | # -s bytes Set the maximum diff size in bytes (-1 for no limit) |
25 | # -T Prefix the mail subject with a [repository name] tag | ||
25 | # -t file Prevent duplicate notifications by saving state to this file | 26 | # -t file Prevent duplicate notifications by saving state to this file |
26 | # -U mask Set the umask for creating the state file | 27 | # -U mask Set the umask for creating the state file |
27 | # -u url Set the URL to the gitweb browser | 28 | # -u url Set the URL to the gitweb browser |
@@ -55,6 +56,9 @@ my $debug = 0; | |||
55 | # omit the author from the mail subject (can be set with the -A option) | 56 | # omit the author from the mail subject (can be set with the -A option) |
56 | my $omit_author = git_config( "notify.omitauthor" ); | 57 | my $omit_author = git_config( "notify.omitauthor" ); |
57 | 58 | ||
59 | # prefix the mail subject with a [repository name] tag (can be set with the -T option) | ||
60 | my $emit_repo = git_config( "notify.emitrepository" ); | ||
61 | |||
58 | # show the committer if different from the author (can be set with the -C option) | 62 | # show the committer if different from the author (can be set with the -C option) |
59 | my $show_committer = git_config( "notify.showcommitter" ); | 63 | my $show_committer = git_config( "notify.showcommitter" ); |
60 | 64 | ||
@@ -104,6 +108,7 @@ sub usage() | |||
104 | print " -n max Set max number of individual mails to send\n"; | 108 | print " -n max Set max number of individual mails to send\n"; |
105 | print " -r name Set the git repository name\n"; | 109 | print " -r name Set the git repository name\n"; |
106 | print " -s bytes Set the maximum diff size in bytes (-1 for no limit)\n"; | 110 | print " -s bytes Set the maximum diff size in bytes (-1 for no limit)\n"; |
111 | print " -T Prefix the mail subject with a [repository name] tag\n"; | ||
107 | print " -t file Prevent duplicate notifications by saving state to this file\n"; | 112 | print " -t file Prevent duplicate notifications by saving state to this file\n"; |
108 | print " -U mask Set the umask for creating the state file\n"; | 113 | print " -U mask Set the umask for creating the state file\n"; |
109 | print " -u url Set the URL to the gitweb browser\n"; | 114 | print " -u url Set the URL to the gitweb browser\n"; |
@@ -287,6 +292,7 @@ sub parse_options() | |||
287 | elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; } | 292 | elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; } |
288 | elsif ($arg eq '-r') { $repos_name = shift @ARGV; } | 293 | elsif ($arg eq '-r') { $repos_name = shift @ARGV; } |
289 | elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; } | 294 | elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; } |
295 | elsif ($arg eq '-T') { $emit_repo = 1; } | ||
290 | elsif ($arg eq '-t') { $state_file = shift @ARGV; } | 296 | elsif ($arg eq '-t') { $state_file = shift @ARGV; } |
291 | elsif ($arg eq '-U') { $mode_mask = shift @ARGV; } | 297 | elsif ($arg eq '-U') { $mode_mask = shift @ARGV; } |
292 | elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; } | 298 | elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; } |
@@ -305,7 +311,10 @@ sub parse_options() | |||
305 | sub mail_notification($$$@) | 311 | sub mail_notification($$$@) |
306 | { | 312 | { |
307 | my ($name, $subject, $content_type, @text) = @_; | 313 | my ($name, $subject, $content_type, @text) = @_; |
314 | |||
315 | $subject = "[$repos_name] $subject" if $emit_repo; | ||
308 | $subject = encode("MIME-Q",$subject); | 316 | $subject = encode("MIME-Q",$subject); |
317 | |||
309 | if ($debug) | 318 | if ($debug) |
310 | { | 319 | { |
311 | binmode STDOUT, ":utf8"; | 320 | binmode STDOUT, ":utf8"; |