diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-03-27 15:09:41 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-03-27 15:09:41 -0400 |
commit | 825e2b1378b1def4980e36642ed84999599eb017 (patch) | |
tree | 8c5225715c9cf7a3405dbc679f124f74ca9983e7 /IkiWiki/Plugin/git.pm | |
parent | f4a1732b0e65ea4459098e4e852dff10a5af9320 (diff) | |
parent | c8237b4351f6023b3d3a661df2568c6d7488b8cf (diff) |
Merge branch 'master' into po
Conflicts:
debian/control
Diffstat (limited to 'IkiWiki/Plugin/git.pm')
-rw-r--r-- | IkiWiki/Plugin/git.pm | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 042c69f5a..68b114a73 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -136,14 +136,16 @@ sub safe_git (&@) { } # In parent. + # git output is probably utf-8 encoded, but may contain + # other encodings or invalidly encoded stuff. So do not rely + # on the normal utf-8 IO layer, decode it by hand. + binmode($OUT); + my @lines; while (<$OUT>) { + $_=decode_utf8($_, 0); + chomp; - - # check for invalid utf-8, and toss it back to avoid crashes - if (! utf8::valid($_)) { - $_=encode_utf8($_); - } push @lines, $_; } @@ -447,7 +449,7 @@ sub rcs_commit_staged ($$$) { # Set the commit author and email to the web committer. my %env=%ENV; if (defined $user || defined $ipaddr) { - my $u=defined $user ? $user : $ipaddr; + my $u=encode_utf8(defined $user ? $user : $ipaddr); $ENV{GIT_AUTHOR_NAME}=$u; $ENV{GIT_AUTHOR_EMAIL}="$u\@web"; } @@ -592,8 +594,8 @@ sub rcs_getctime ($) { # Remove srcdir prefix $file =~ s/^\Q$config{srcdir}\E\/?//; - my $sha1 = git_sha1($file); - my $ci = git_commit_info($sha1, 1); + my @sha1s = run_or_non('git', 'rev-list', 'HEAD', '--', $file); + my $ci = git_commit_info($sha1s[$#sha1s], 1); my $ctime = $ci->{'author_epoch'}; debug("ctime for '$file': ". localtime($ctime)); |