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 | e067f2d8ac807fd1de2fdbc77e76641c486700b6 (patch) | |
tree | b93105153ff081cc136c6bb49bf45647e03af571 | |
parent | 7854dad6e08c58334bbff1a5c0e0da2f847c9ef1 (diff) | |
download | monitoring-plugins-e067f2d8ac807fd1de2fdbc77e76641c486700b6.tar.gz |
git-notify: Drop the $sent_notices variable
Now that we don't ignore empty commits anymore, there's no need to keep
track of the number of commits actually notified about, as that will
always be equal to the number of commits returned by get_new_commits().
-rwxr-xr-x | tools/git-notify | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tools/git-notify b/tools/git-notify index d53461c8..548f7da9 100755 --- a/tools/git-notify +++ b/tools/git-notify | |||
@@ -47,9 +47,6 @@ my $cia_address = "cia\@cia.navi.cx"; | |||
47 | # debug mode | 47 | # debug mode |
48 | my $debug = 0; | 48 | my $debug = 0; |
49 | 49 | ||
50 | # number of generated (non-CIA) notifications | ||
51 | my $sent_notices = 0; | ||
52 | |||
53 | # configuration parameters | 50 | # configuration parameters |
54 | 51 | ||
55 | # base URL of the gitweb repository browser (can be set with the -u option) | 52 | # base URL of the gitweb repository browser (can be set with the -u option) |
@@ -393,7 +390,6 @@ sub send_ref_notice($$@) | |||
393 | 390 | ||
394 | mail_notification($commitlist_address, "$refname $reftype $action", | 391 | mail_notification($commitlist_address, "$refname $reftype $action", |
395 | "text/plain; charset=us-ascii", @notice); | 392 | "text/plain; charset=us-ascii", @notice); |
396 | $sent_notices++; | ||
397 | } | 393 | } |
398 | 394 | ||
399 | # send a commit notice to a mailing list | 395 | # send a commit notice to a mailing list |
@@ -467,7 +463,6 @@ sub send_commit_notice($$) | |||
467 | $subject .= ": " . truncate_str(${$info{"log"}}[0],50); | 463 | $subject .= ": " . truncate_str(${$info{"log"}}[0],50); |
468 | $_ = decode($info{"encoding"}, $_) for @notice; | 464 | $_ = decode($info{"encoding"}, $_) for @notice; |
469 | mail_notification($commitlist_address, $subject, "text/plain; charset=UTF-8", @notice); | 465 | mail_notification($commitlist_address, $subject, "text/plain; charset=UTF-8", @notice); |
470 | $sent_notices++; | ||
471 | } | 466 | } |
472 | 467 | ||
473 | # send a commit notice to the CIA server | 468 | # send a commit notice to the CIA server |
@@ -538,7 +533,6 @@ sub send_global_notice($$$) | |||
538 | } | 533 | } |
539 | 534 | ||
540 | mail_notification($commitlist_address, "New commits on branch $ref", "text/plain; charset=UTF-8", @$notice); | 535 | mail_notification($commitlist_address, "New commits on branch $ref", "text/plain; charset=UTF-8", @$notice); |
541 | $sent_notices++; | ||
542 | } | 536 | } |
543 | 537 | ||
544 | # send all the notices | 538 | # send all the notices |
@@ -583,7 +577,7 @@ sub send_all_notices($$$) | |||
583 | { | 577 | { |
584 | send_global_notice( $refname, $old_sha1, $new_sha1 ) if $commitlist_address; | 578 | send_global_notice( $refname, $old_sha1, $new_sha1 ) if $commitlist_address; |
585 | } | 579 | } |
586 | else | 580 | elsif (@$commits > 0) |
587 | { | 581 | { |
588 | foreach my $commit (@$commits) | 582 | foreach my $commit (@$commits) |
589 | { | 583 | { |
@@ -591,7 +585,7 @@ sub send_all_notices($$$) | |||
591 | send_cia_notice( $refname, $commit ) if $cia_project_name; | 585 | send_cia_notice( $refname, $commit ) if $cia_project_name; |
592 | } | 586 | } |
593 | } | 587 | } |
594 | if ($sent_notices == 0 and $commitlist_address) | 588 | elsif ($commitlist_address) |
595 | { | 589 | { |
596 | @notice = ( "Old SHA1: $old_sha1", "New SHA1: $new_sha1" ); | 590 | @notice = ( "Old SHA1: $old_sha1", "New SHA1: $new_sha1" ); |
597 | send_ref_notice( $ref, "modified", @notice ); | 591 | send_ref_notice( $ref, "modified", @notice ); |