[PATCH] gitweb: Fix setting $/ in parse_commit()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---

 gitweb/gitweb.perl |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 13f04d6..9868485 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1165,12 +1165,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;
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]