aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2009-10-24 11:44:16 +0200
committerGravatar Holger Weiss <holger@zedat.fu-berlin.de> 2009-10-24 11:44:16 +0200
commitdb63fbfa036f5cd757aedf4547fef9e195a8c285 (patch)
treeb2bd33641cb4ded181d9808797047bade30fb0fa
parent5445b9769f254781e482062bacc6603a5cd63059 (diff)
downloadmonitoring-plugins-db63fbfa036f5cd757aedf4547fef9e195a8c285.tar.gz
git-notify: Ignore "empty" commits
Omit notifications regarding commits which don't change the tree whatsoever.
-rwxr-xr-xtools/git-notify10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/git-notify b/tools/git-notify
index 1b10f690..ccde4bee 100755
--- a/tools/git-notify
+++ b/tools/git-notify
@@ -230,6 +230,12 @@ sub send_commit_notice($$)
my %info = get_object_info($obj);
my @notice = ();
+ 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;
+
+ return if length($diff) == 0;
+
push @notice,
"Module: $repos_name",
"Branch: $ref",
@@ -247,10 +253,6 @@ sub send_commit_notice($$)
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;
-
if (($max_diff_size == -1) || (length($diff) < $max_diff_size))
{
push @notice, $diff;