summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af5e252)
raw | patch | inline | side by side (parent: af5e252)
author | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 24 Oct 2009 20:55:44 +0000 (22:55 +0200) | ||
committer | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 24 Oct 2009 20:55:44 +0000 (22:55 +0200) |
Make sure that commit messages which use an encoding other than US-ASCII
or UTF-8 are handled correctly. Also, assume that the diff contents use
the same encoding as the commit message. This assumption may well be
wrong, but that's the best we can do.
or UTF-8 are handled correctly. Also, assume that the diff contents use
the same encoding as the commit message. This assumption may well be
wrong, but that's the best we can do.
tools/git-notify | patch | blob | history |
diff --git a/tools/git-notify b/tools/git-notify
index a89104a643f397260e18f2e5794c287b3430a14f..b10b1bc4d44ca850c76c8a81d73cadad8dff0989 100755 (executable)
--- a/tools/git-notify
+++ b/tools/git-notify
#
use strict;
-use open ':utf8';
use Fcntl ':flock';
-use Encode 'encode';
+use Encode qw(encode decode);
use Cwd 'realpath';
-binmode STDIN, ':utf8';
-binmode STDOUT, ':utf8';
-
sub git_config($);
sub get_repos_name();
$subject = encode("MIME-Q",$subject);
if ($debug)
{
+ binmode STDOUT, ":utf8";
print "---------------------\n";
print "To: $name\n";
print "Subject: $subject\n";
{
exec $mailer, "-s", $subject, "-a", "Content-Type: $content_type", $name or die "Cannot exec $mailer";
}
+ binmode MAIL, ":utf8";
print MAIL join("\n", @text), "\n";
close MAIL;
}
my @log = ();
my $do_log = 0;
+ $info{"encoding"} = "utf-8";
+
open OBJ, "-|" or exec "git", "cat-file", "commit", $obj or die "cannot run git-cat-file";
while (<OBJ>)
{
chomp;
if ($do_log) { push @log, $_; }
elsif (/^$/) { $do_log = 1; }
+ elsif (/^encoding (.+)/) { $info{"encoding"} = $1; }
elsif (/^(author|committer) ((.*) (<.*>)) (\d+) ([+-]\d+)$/)
{
$info{$1} = $2;
push @notice, "Diff: $gitweb_url/?a=commitdiff;h=$obj" if $gitweb_url;
}
+ $_ = decode($info{"encoding"}, $_) for @notice;
+
mail_notification($commitlist_address,
$info{"author_name"} . ": " . truncate_str(${$info{"log"}}[0], 50),
"text/plain; charset=UTF-8", @notice);