diff options
-rwxr-xr-x | libexec/git-notify | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libexec/git-notify b/libexec/git-notify index 8c6400a..64da7c0 100755 --- a/libexec/git-notify +++ b/libexec/git-notify | |||
@@ -44,7 +44,8 @@ sub get_repos_name(); | |||
44 | # | 44 | # |
45 | # FIXME: Turn this into a proper git-notify option. | 45 | # FIXME: Turn this into a proper git-notify option. |
46 | # | 46 | # |
47 | my $from = "Git Repository <git\@monitoring-plugins.org>"; | 47 | my $from_address = "git\@monitoring-plugins.org"; |
48 | my $from = "Git Repository <$from_address>"; | ||
48 | 49 | ||
49 | # some parameters you may want to change | 50 | # some parameters you may want to change |
50 | 51 | ||
@@ -323,14 +324,14 @@ sub parse_options() | |||
323 | } | 324 | } |
324 | 325 | ||
325 | # send an email notification | 326 | # send an email notification |
326 | sub mail_notification($$$@) | 327 | sub mail_notification($$$$@) |
327 | { | 328 | { |
328 | my ($name, $subject, $content_type, @text) = @_; | 329 | my ($from, $to, $subject, $content_type, @text) = @_; |
329 | 330 | ||
330 | $subject = "[$repos_name] $subject" if ($emit_repo and $name ne $cia_address); | 331 | $subject = "[$repos_name] $subject" if ($emit_repo and $to ne $cia_address); |
331 | $subject = encode("MIME-Q",$subject); | 332 | $subject = encode("MIME-Q",$subject); |
332 | 333 | ||
333 | my @header = ("From: $from", "To: $name", "Subject: $subject", "Content-Type: $content_type"); | 334 | my @header = ("From: $from", "To: $to", "Subject: $subject", "Content-Type: $content_type"); |
334 | 335 | ||
335 | if ($debug) | 336 | if ($debug) |
336 | { | 337 | { |
@@ -438,7 +439,7 @@ sub send_ref_notice($$@) | |||
438 | "", | 439 | "", |
439 | "The $refname $reftype has been $action."); | 440 | "The $refname $reftype has been $action."); |
440 | 441 | ||
441 | mail_notification($commitlist_address, "$refname $reftype $action", | 442 | mail_notification($from, $commitlist_address, "$refname $reftype $action", |
442 | "text/plain; charset=us-ascii", @notice); | 443 | "text/plain; charset=us-ascii", @notice); |
443 | } | 444 | } |
444 | 445 | ||
@@ -515,7 +516,8 @@ sub send_commit_notice($$) | |||
515 | 516 | ||
516 | $subject .= truncate_str(${$info{"log"}}[0],50); | 517 | $subject .= truncate_str(${$info{"log"}}[0],50); |
517 | $_ = decode($info{"encoding"}, $_) for @notice; | 518 | $_ = decode($info{"encoding"}, $_) for @notice; |
518 | mail_notification($commitlist_address, $subject, "text/plain; charset=UTF-8", @notice); | 519 | mail_notification("$info{'committer_name'} <$from_address>", $commitlist_address, $subject, |
520 | "text/plain; charset=UTF-8", @notice); | ||
519 | } | 521 | } |
520 | 522 | ||
521 | # send a commit notice to the CIA server | 523 | # send a commit notice to the CIA server |
@@ -571,7 +573,7 @@ sub send_cia_notice($$) | |||
571 | " <timestamp>" . $info{"author_date"} . "</timestamp>", | 573 | " <timestamp>" . $info{"author_date"} . "</timestamp>", |
572 | "</message>"; | 574 | "</message>"; |
573 | 575 | ||
574 | mail_notification($cia_address, "DeliverXML", "text/xml", @cia_text); | 576 | mail_notification($from, $cia_address, "DeliverXML", "text/xml", @cia_text); |
575 | } | 577 | } |
576 | 578 | ||
577 | # send a global commit notice when there are too many commits for individual mails | 579 | # send a global commit notice when there are too many commits for individual mails |
@@ -585,7 +587,7 @@ sub send_global_notice($$$) | |||
585 | $rev =~ s/^commit /URL: ${gitweb_url}\/commit\/?id=/ if $gitweb_url; | 587 | $rev =~ s/^commit /URL: ${gitweb_url}\/commit\/?id=/ if $gitweb_url; |
586 | } | 588 | } |
587 | 589 | ||
588 | mail_notification($commitlist_address, "New commits on branch $ref", "text/plain; charset=UTF-8", @$notice); | 590 | mail_notification($from, $commitlist_address, "New commits on branch $ref", "text/plain; charset=UTF-8", @$notice); |
589 | } | 591 | } |
590 | 592 | ||
591 | # send all the notices | 593 | # send all the notices |