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>
Petr Baudis committed
Oct 24, 2006 at 02:39 UTC
a153adf683d2b6e22c7e892ed8a161b140156186
1 file changed
+1
-2
gitweb/gitweb.perl
+1
-2
@@ -1009,12 +1009,11 @@ sub parse_commit {
1009
if (defined $commit_text) {
1010
@commit_lines = @$commit_text;
1011
} else {
1012
- $/ = "\0";
1012
+ local $/ = "\0";
1013
open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", "--max-count=1", $commit_id
1014
or return;
1015
@commit_lines = split '\n', <$fd>;
1016
close $fd or return;
1017
- $/ = "\n";
1017
pop @commit_lines;
1018
}
1019
my $header = shift @commit_lines;