From: Holger Weiss Date: Sat, 24 Oct 2009 09:44:16 +0000 (+0200) Subject: git-notify: Ignore "empty" commits X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=db63fbfa;p=nagiosplug.git git-notify: Ignore "empty" commits Omit notifications regarding commits which don't change the tree whatsoever. --- diff --git a/tools/git-notify b/tools/git-notify index 1b10f69..ccde4be 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("", ); + 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("", ); 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( "", ); - close DIFF; - if (($max_diff_size == -1) || (length($diff) < $max_diff_size)) { push @notice, $diff;