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

Re: git-mailinfo: cut lines at ^M

From
Junio C Hamano <junkio@cox.net>
Date
Jan 16, 2006, 23:38 UTC
Message-ID
<7v1wz7n3oz.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.64.0601161104070.13339@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> Junio, feel free to ignore this. It shouldn't hurt, but
> admittedly it's a stupid hack for a problem that has nothing
> to do with git...

This is doing "instead of removing trailing spaces, terminate a line at the first CR or LF and discard the rest". So your "^M)" at the end, especially the close paren, is dropped.

I've briefly wondered if a better alternative is to split lines at "\r\n", "\n", or "\r", which would make the next line begin with ")" in your example. Normally the first two would have already been done by fgets(), so the alternative approach would involve wrapping the use of fgets() with something of our own. I do not think "keeping the rest of the line after '\r' in the middle" is worth that trouble, so I am personally fine with your patch.

Previous: Linus TorvaldsNext: Linus Torvalds
Message 2 of 3 in “git-mailinfo: cut lines at ^M”
  1. Linus TorvaldsJan 16, 2006
  2. Junio C HamanoJan 16, 2006
  3. Linus TorvaldsJan 16, 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.