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

[PATCH] cvsserver: Removing leading and trailing newlines for "cvs log"

From
FNFredrik Noring <noring@nocrew.org>
Date
Apr 13, 2008, 10:54 UTC
Message-ID
<CC1E4EF8-9A0A-4463-8704-18849457DC69@nocrew.org>
Hi all,

Attached patch removes the leading and trailing newlines that the cvsserver command adds to commit messages for "cvs log".

  git-cvsserver.perl |    4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

Another note: For every commit, cvsserver claims lines changed are "+2 -3" as hard-coded values no matter what, but that's a fix for another day. ;)

Thanks, Fredrik

diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index 59a1609..1927c1c 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -3049,7 +3049,9 @@ sub commitmessage
 
     my @lines = safe_pipe_capture("git-cat-file", "commit", $commithash);
     shift @lines while ( $lines[0] =~ /\S/ );
-    $message = join("",@lines);
+    shift @lines;
+    map(s/\n$//s, @lines);
+    $message = join("\n", @lines);
     $message .= " " if ( $message =~ /\n$/ );
     return $message;
 }
Message 1 of 1 in “cvsserver: Removing leading and trailing newlines for "cvs log"”
  1. cvsserver: Removing leading and trailing newlines for "cvs log"Fredrik Noring, Apr 13, 2008

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.