提交 a153adf6 编写于 作者: P Petr Baudis 提交者: Junio C Hamano

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: NPetr Baudis <pasky@suse.cz>
Signed-off-by: NJunio C Hamano <junkio@cox.net>
上级 83543a24
...@@ -1009,12 +1009,11 @@ sub parse_commit { ...@@ -1009,12 +1009,11 @@ sub parse_commit {
if (defined $commit_text) { if (defined $commit_text) {
@commit_lines = @$commit_text; @commit_lines = @$commit_text;
} else { } else {
$/ = "\0"; local $/ = "\0";
open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", "--max-count=1", $commit_id open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", "--max-count=1", $commit_id
or return; or return;
@commit_lines = split '\n', <$fd>; @commit_lines = split '\n', <$fd>;
close $fd or return; close $fd or return;
$/ = "\n";
pop @commit_lines; pop @commit_lines;
} }
my $header = shift @commit_lines; my $header = shift @commit_lines;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册