summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51771dc)
raw | patch | inline | side by side (parent: 51771dc)
author | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 24 Oct 2009 09:44:10 +0000 (11:44 +0200) | ||
committer | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 24 Oct 2009 09:44:10 +0000 (11:44 +0200) |
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.
objects listed by git-rev-list(1) are considered, and git-rev-list(1)
never spits out the sha1 of a tag object.
tools/git-notify | patch | blob | history |
diff --git a/tools/git-notify b/tools/git-notify
index ce013891e850ede89a688d389fb9a2462a6b860e..1b10f69050932f9e19349b25823d6bf9a70e801a 100755 (executable)
--- a/tools/git-notify
+++ b/tools/git-notify
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;
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;
$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;
}
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",
"---",
"";
- 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
my %info = get_object_info($commit);
my @cia_text = ();
- return if $info{"type"} ne "commit";
-
push @cia_text,
"<message>",
" <generator>",