]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Fix setting $/ in parse_commit()
authorPetr Baudis <redacted>
Tue, 24 Oct 2006 00:39:14 +0000 (02:39 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:10 +0000 (00:07 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index b3e6ed0e6a1570320dfadc0914834c11237d9a320a6449a5a41835b7813f615f..63416f8ccce5eecd72193bf4dafe620bf9117561afc94ecbf27f94a0ed79382c 100755 (executable)
@@ -1102,12 +1102,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;
This page took 0.241063 seconds and 4 git commands to generate.