|
|
@@ -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>",
|