{"thread":{"id":"6023","subject":"[PATCH] gitweb: Fix setting $/ in parse_commit()","startedAt":"2006-10-24T00:39:14Z","lastAt":"2006-10-24T00:39:14Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"29791","messageId":"20061024003913.21247.70740.stgit@rover","threadId":"6023","inReplyTo":null,"subject":"[PATCH] gitweb: Fix setting $/ in parse_commit()","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-10-24T00:39:14Z","receivedAt":"2006-10-24T00:39:14Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"If the commit couldn't have been read, $/ wasn't restored to \\n properly,\ncausing random havoc like git_get_ref_list() returning the ref names with\ntrailing \\n.\n\nAside of potential confusion in the body of git_search(), no other $/\nsurprises are hopefully hidden in the code.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n gitweb/gitweb.perl |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 13f04d6..9868485 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1165,12 +1165,11 @@ sub parse_commit {\n \tif (defined $commit_text) {\n \t\t@commit_lines = @$commit_text;\n \t} else {\n-\t\t$/ = \"\\0\";\n+\t\tlocal $/ = \"\\0\";\n \t\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--header\", \"--parents\", \"--max-count=1\", $commit_id\n \t\t\tor return;\n \t\t@commit_lines = split '\\n', <$fd>;\n \t\tclose $fd or return;\n-\t\t$/ = \"\\n\";\n \t\tpop @commit_lines;\n \t}\n \tmy $header = shift @commit_lines;\n"}]}