Skip to content

Commit a153adf

Browse files
Petr BaudisJunio C Hamano
authored andcommitted
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 <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 83543a2 commit a153adf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,12 +1009,11 @@ sub parse_commit {
10091009
if (defined $commit_text) {
10101010
@commit_lines = @$commit_text;
10111011
} else {
1012-
$/ = "\0";
1012+
local $/ = "\0";
10131013
open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", "--max-count=1", $commit_id
10141014
or return;
10151015
@commit_lines = split '\n', <$fd>;
10161016
close $fd or return;
1017-
$/ = "\n";
10181017
pop @commit_lines;
10191018
}
10201019
my $header = shift @commit_lines;

0 commit comments

Comments
 (0)