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

[gitweb/patch] commit log bodies should be pre-format tagged

From
PJPaul Jakma <paul@clubi.ie>
Date
May 28, 2006, 10:28 UTC
Message-ID
<Pine.LNX.4.64.0605281118060.22571@sheen.jakma.org>
Hi Kay,

I don't know about you, but when I write commit messages, I don't HTML format them. ;)

Attached patch wraps commit log messages in HTML pre tags. Without this patch, any commits with any kind of ASCII-formatted structure look strange at best (e.g. traditional GNUish ChangeLog style which use indentation), and unintelligble at worst (ASCII art or diagrammes).

The log, commit and commitdiff pages all still validate, and the RSS feed looks /much/ better in Liferea. Probably it could be done in some smarter way with divs and CSS though, but hey.

Please apply. :)
regards,
-- 
Paul Jakma	paul@clubi.ie	paul@jakma.org	Key ID: 64A2FF6A
Fortune:
Fiber optics caused gas main leak

--- gitweb.cgi.orig	2006-05-28 10:30:38.000000000 +0100
+++ gitweb.cgi	2006-05-28 11:12:52.000000000 +0100
@@ -1218,12 +1218,12 @@
 	}
 	print "</table>\n\n" .
 	      "</div>\n";
-	print "<div class=\"page_body\">";
+	print "<div class=\"page_body\"><pre>";
 	my $comment = $tag{'comment'};
 	foreach my $line (@$comment) {
-		print esc_html($line) . "<br/>\n";
+		print esc_html($line) . "\n";
 	}
-	print "</div>\n";
+	print "</pre></div>\n";
 	git_footer_html();
 }
 
@@ -1547,22 +1547,22 @@
 		      "<link>" . esc_html("$my_url?p=$project;a=commit;h=$commit") . "</link>\n" .
 		      "<description>" . esc_html($co{'title'}) . "</description>\n" .
 		      "<content:encoded>" .
-		      "<![CDATA[\n";
+		      "<![CDATA[<pre>\n";
 		my $comment = $co{'comment'};
 		foreach my $line (@$comment) {
 			$line = decode("utf8", $line, Encode::FB_DEFAULT);
-			print "$line<br/>\n";
+			print "$line\n";
 		}
-		print "<br/>\n";
+		print "\n";
 		foreach my $line (@difftree) {
 			if (!($line =~ m/^:([0-7]{6}) ([0-7]{6}) ([0-9a-fA-F]{40}) ([0-9a-fA-F]{40}) (.)([0-9]{0,3})\t(.*)$/)) {
 				next;
 			}
 			my $file = validate_input(unquote($7));
 			$file = decode("utf8", $file, Encode::FB_DEFAULT);
-			print "$file<br/>\n";
+			print "$file\n";
 		}
-		print "]]>\n" .
+		print "</pre>]]>\n" .
 		      "</content:encoded>\n" .
 		      "</item>\n";
 	}
@@ -1673,7 +1673,7 @@
 		      "</div>\n" .
 		      "<i>" . esc_html($co{'author_name'}) .  " [$ad{'rfc2822'}]</i><br/>\n" .
 		      "</div>\n" .
-		      "<div class=\"log_body\">\n";
+		      "<div class=\"log_body\"><pre>\n";
 		my $comment = $co{'comment'};
 		my $empty = 0;
 		foreach my $line (@$comment) {
@@ -1688,12 +1688,12 @@
 			} else {
 				$empty = 0;
 			}
-			print format_log_line_html($line) . "<br/>\n";
+			print format_log_line_html($line) . "\n";
 		}
 		if (!$empty) {
-			print "<br/>\n";
+			print "\n";
 		}
-		print "</div>\n";
+		print "</pre></div>\n";
 	}
 	git_footer_html();
 }
@@ -1783,7 +1783,7 @@
 	}
 	print "</table>". 
 	      "</div>\n";
-	print "<div class=\"page_body\">\n";
+	print "<div class=\"page_body\"><pre>\n";
 	my $comment = $co{'comment'};
 	my $empty = 0;
 	my $signed = 0;
@@ -1799,13 +1799,13 @@
 		}
 		if ($line =~ m/^ *(signed[ \-]off[ \-]by[ :]|acked[ \-]by[ :]|cc[ :])/i) {
 			$signed = 1;
-			print "<span style=\"color: #888888\">" . esc_html($line) . "</span><br/>\n";
+			print "</pre><span style=\"color: #888888\">" . esc_html($line) . "</span><br/><pre>\n";
 		} else {
 			$signed = 0;
-			print format_log_line_html($line) . "<br/>\n";
+			print format_log_line_html($line) . "\n";
 		}
 	}
-	print "</div>\n";
+	print "</pre></div>\n";
 	print "<div class=\"list_head\">\n";
 	if ($#difftree > 10) {
 		print(($#difftree + 1) . " files changed:\n");
@@ -1982,7 +1982,7 @@
 	print "<div>\n" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" .
 	      "</div>\n";
-	print "<div class=\"page_body\">\n";
+	print "<div class=\"page_body\"><pre>\n";
 	my $comment = $co{'comment'};
 	my $empty = 0;
 	my $signed = 0;
@@ -2004,9 +2004,9 @@
 		} else {
 			$empty = 0;
 		}
-		print format_log_line_html($line) . "<br/>\n";
+		print format_log_line_html($line) . "\n";
 	}
-	print "<br/>\n";
+	print "</pre><br/>\n";
 	foreach my $line (@difftree) {
 		# ':100644 100644 03b218260e99b78c6df0ed378e59ed9205ccc96d 3b93d5e7cc7f7dd4ebed13a5cc1a4ad976fc94d8 M      ls-files.c'
 		# ':100644 100644 7f9281985086971d3877aca27704f2aaf9c448ce bc190ebc71bbd923f2b728e505408f5e54bd073a M      rev-tree.c'
Message 1 of 1 in “commit log bodies should be pre-format tagged”
  1. commit log bodies should be pre-format taggedPaul Jakma, May 28, 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.