aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2009-10-24 11:44:10 +0200
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2009-10-24 11:44:10 +0200
commit5445b9769f254781e482062bacc6603a5cd63059 (patch)
treee27bd0aa3ad554ef7890578e447baa9d94dbe92e /tools
parent51771dc540eef3be94f5f0a55dc7337f3c597e3f (diff)
downloadmonitoring-plugins-5445b9769f254781e482062bacc6603a5cd63059.tar.gz
git-notify: Remove unused tag notification code
The code which handles notifications regarding tags was unused, as only objects listed by git-rev-list(1) are considered, and git-rev-list(1) never spits out the sha1 of a tag object.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/git-notify77
1 files changed, 22 insertions, 55 deletions
diff --git a/tools/git-notify b/tools/git-notify
index ce013891..1b10f690 100755
--- a/tools/git-notify
+++ b/tools/git-notify
@@ -194,7 +194,7 @@ sub get_repos_name()
return $repos;
}
-# extract the information from a commit or tag object and return a hash containing the various fields
+# extract the information from a commit object and return a hash containing the various fields
sub get_object_info($)
{
my $obj = shift;
@@ -202,21 +202,13 @@ sub get_object_info($)
my @log = ();
my $do_log = 0;
- open TYPE, "-|" or exec "git", "cat-file", "-t", $obj or die "cannot run git-cat-file";
- my $type = <TYPE>;
- chomp $type;
- close TYPE;
-
- open OBJ, "-|" or exec "git", "cat-file", $type, $obj or die "cannot run git-cat-file";
+ open OBJ, "-|" or exec "git", "cat-file", "commit", $obj or die "cannot run git-cat-file";
while (<OBJ>)
{
chomp;
- if ($do_log)
- {
- last if /^-----BEGIN PGP SIGNATURE-----/;
- push @log, $_;
- }
- elsif (/^(author|committer|tagger) ((.*) (<.*>)) (\d+) ([+-]\d+)$/)
+ if ($do_log) { push @log, $_; }
+ elsif (/^$/) { $do_log = 1; }
+ elsif (/^(author|committer) ((.*) (<.*>)) (\d+) ([+-]\d+)$/)
{
$info{$1} = $2;
$info{$1 . "_name"} = $3;
@@ -224,15 +216,9 @@ sub get_object_info($)
$info{$1 . "_date"} = $5;
$info{$1 . "_tz"} = $6;
}
- elsif (/^tag (.*)$/)
- {
- $info{"tag"} = $1;
- }
- elsif (/^$/) { $do_log = 1; }
}
close OBJ;
- $info{"type"} = $type;
$info{"log"} = \@log;
return %info;
}
@@ -243,24 +229,8 @@ sub send_commit_notice($$)
my ($ref,$obj) = @_;
my %info = get_object_info($obj);
my @notice = ();
- my $subject;
- if ($info{"type"} eq "tag")
- {
- push @notice,
- "Module: $repos_name",
- "Branch: $ref",
- "Tag: $obj",
- $gitweb_url ? "URL: $gitweb_url/?a=tag;h=$obj\n" : "",
- "Tagger: " . $info{"tagger"},
- "Date: " . format_date($info{"tagger_date"},$info{"tagger_tz"}),
- "",
- join "\n", @{$info{"log"}};
- $subject = "Tag " . $info{"tag"} . " : " . $info{"tagger_name"} . ": " . ${$info{"log"}}[0];
- }
- else
- {
- push @notice,
+ push @notice,
"Module: $repos_name",
"Branch: $ref",
"Commit: $obj",
@@ -273,27 +243,26 @@ sub send_commit_notice($$)
"---",
"";
- open STAT, "-|" or exec "git", "diff-tree", "--stat", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
- push @notice, join("", <STAT>);
- close STAT;
-
- open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
- my $diff = join( "", <DIFF> );
- close DIFF;
+ open STAT, "-|" or exec "git", "diff-tree", "--stat", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
+ push @notice, join("", <STAT>);
+ close STAT;
- if (($max_diff_size == -1) || (length($diff) < $max_diff_size))
- {
- push @notice, $diff;
- }
- else
- {
- push @notice, "Diff: $gitweb_url/?a=commitdiff;h=$obj" if $gitweb_url;
- }
+ open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
+ my $diff = join( "", <DIFF> );
+ close DIFF;
- $subject = $info{"author_name"} . ": " . ${$info{"log"}}[0];
+ if (($max_diff_size == -1) || (length($diff) < $max_diff_size))
+ {
+ push @notice, $diff;
+ }
+ else
+ {
+ push @notice, "Diff: $gitweb_url/?a=commitdiff;h=$obj" if $gitweb_url;
}
- mail_notification($commitlist_address, $subject, "text/plain; charset=UTF-8", @notice);
+ mail_notification($commitlist_address,
+ $info{"author_name"} . ": " . ${$info{"log"}}[0],
+ "text/plain; charset=UTF-8", @notice);
}
# send a commit notice to the CIA server
@@ -303,8 +272,6 @@ sub send_cia_notice($$)
my %info = get_object_info($commit);
my @cia_text = ();
- return if $info{"type"} ne "commit";
-
push @cia_text,
"<message>",
" <generator>",