From: Petr Baudis Date: Tue, 24 Oct 2006 00:39:14 +0000 (+0200) Subject: gitweb: Fix setting $/ in parse_commit() X-Git-Tag: v1.4.3.2^0 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a153adf683d2b6e22c7e892ed8a161b140156186;p=git.git gitweb: Fix setting $/ in parse_commit() If the commit couldn't have been read, $/ wasn't restored to \n properly, causing random havoc like git_get_ref_list() returning the ref names with trailing \n. Aside of potential confusion in the body of git_search(), no other $/ surprises are hopefully hidden in the code. Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 23b26a2db..2390603e9 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1009,12 +1009,11 @@ sub parse_commit { if (defined $commit_text) { @commit_lines = @$commit_text; } else { - $/ = "\0"; + local $/ = "\0"; open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", "--max-count=1", $commit_id or return; @commit_lines = split '\n', <$fd>; close $fd or return; - $/ = "\n"; pop @commit_lines; } my $header = shift @commit_lines;