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

[EGIT PATCH] Do not fill paragraphs in the commit message viewer after any sob.

From
Robin Rosenberg <robin.rosenberg@dewire.com>
Date
Apr 13, 2009, 23:26 UTC
Message-ID
<1239665170-24090-1-git-send-email-robin.rosenberg@dewire.com>

The fill-paragraph rules are ad-hoc and this seems like an improvement. Sometimes we add strange extra tags after the sob lines, so don't pretty-format these.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../ui/internal/history/CommitMessageViewer.java   |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
index d21555c..fc83782 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
@@ -181,12 +181,18 @@ private void format() {
 		makeGrayText(d, styles);
 		d.append("\n");
 		String msg = commit.getFullMessage();
-		if (fill)
-			msg = msg.replaceAll("([\\w.; \t])\n(\\w)","$1 $2");
+		Pattern p = Pattern.compile("\n([A-Z](?:[A-Za-z]+-)+by: [^\n]+)");
+		if (fill) {
+			Matcher spm = p.matcher(msg);
+			if (spm.find()) {
+				String subMsg = msg.substring(0, spm.end());
+				msg = subMsg.replaceAll("([\\w.,; \t])\n(\\w)", "$1 $2")
+						+ msg.substring(spm.end());
+			}
+		}
 		int h0 = d.length();
 		d.append(msg);
 
-		Pattern p = Pattern.compile("\n([A-Z](?:[A-Za-z]+-)+by: [^\n]+)");
 		Matcher matcher = p.matcher(msg);
 		while (matcher.find()) {
 			styles.add(new StyleRange(h0 + matcher.start(), matcher.end()-matcher.start(), null,  null, SWT.ITALIC));
-- 
1.6.2.2.446.gfbdc0
Message 1 of 1 in “Do not fill paragraphs in the commit message viewer after any sob.”
  1. Do not fill paragraphs in the commit message viewer after any sob.Robin Rosenberg, Apr 13, 2009

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.