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

gitweb showing slash r at the end of line

From
Ondra Medek <xmedeko@gmail.com>
Date
Jan 27, 2012, 14:19 UTC
Message-ID
<1327673954458-7229895.post@n2.nabble.com>

Hi, we have gitweb running on Linux box. Some files have Windows line ending (CRLF) end we do not use core.autcrlf translation. gitweb show the last \r in the end of each line, which is annoying. I have creates a simple patch to avoid this. It adds just one line. I am not sure if the regexp should contain 'g' switch in the end. Also, not sure if there shoul be some config option to switch on/off this?

Cheers
Ondra
---
 gitweb/gitweb.perl |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index abb5a79..92175bc 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1500,6 +1500,7 @@ sub esc_html {
        if ($opts{'-nbsp'}) {
                $str =~ s/ /&nbsp;/g;
        }
+       $str =~ s/\r$//;
        $str =~ s|([[:cntrl:]])|(($1 ne "\t") ? quot_cec($1) : $1)|eg;
        return $str;
 }
--
1.7.8.4


--
View this message in context: http://git.661346.n2.nabble.com/gitweb-showing-slash-r-at-the-end-of-line-tp7229895p7229895.html
Sent from the git mailing list archive at Nabble.com.
Next: Jakub Narebski
Message 1 of 8 in “gitweb showing slash r at the end of line”
  1. Ondra MedekJan 27, 2012
  2. Jakub NarebskiJan 27, 2012
  3. Junio C HamanoJan 27, 2012
  4. Jakub NarebskiJan 28, 2012
  5. Ondra MedekJan 30, 2012
  6. Jakub NarebskiJan 30, 2012
  7. Ondra MedekJan 30, 2012
  8. Jakub NarebskiFeb 2, 2012

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.