git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Petr Baudis <pasky@suse.cz>
Date
Oct 24, 2006, 00:39 UTC
Message-ID
<20061024003913.21247.70740.stgit@rover>

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>
---
 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;
Message 1 of 1 in “gitweb: Fix setting $/ in parse_commit()”
  1. gitweb: Fix setting $/ in parse_commit()Petr Baudis, Oct 24, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.