From: Junio C Hamano Date: Mon, 16 Jan 2006 23:38:52 GMT Subject: Re: git-mailinfo: cut lines at ^M Message-ID: <7v1wz7n3oz.fsf@assigned-by-dhcp.cox.net> In-Reply-To: Linus Torvalds 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.