'git mailinfo' whitespace bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



'git mailinfo' removes the whitespace from the beginning of the email 
body, but it does it incorrectly.

In particular, some people use indented paragraphs, like this:

	  Four-score and Four score and seven years ago our fathers 
   brought forth, upon this continent, a new nation, conceived in Liberty, 
   and dedicated to the proposition that all men are created equal.

	Now we are engaged in a great civil war, testing whether that 
   nation, or any nation so conceived, and so dedicated, can long endure. 
   We are met here on a great battlefield of that war. We have come to 
   dedicate a portion of it as a final resting place for those who here 
   gave their lives that that nation might live. It is altogether fitting 
   and proper that we should do this.

   ...

and mailinfo will not just remove empty lines from the beginning of the 
email body, it will also remove the _first_ indentation (but not any 
others). Which makes the whole thing come out wrong.

I bisected it, and this bug was introduced almost two years ago. In commit 
3b6121f69b2 ("git-mailinfo: use strbuf's instead of fixed buffers"), to be 
exact. I'm pretty sure the bug is that handle_commit_msg() was changed to 
use 'strbuf_ltrim()' for the 'still_looking' case.

Before commit 3b6121f69b2, it would create a new variable that had the 
trimmed results ("char *cp = line;"), after that commit it would just trim 
the line itself. Which is correct for the case of it being a header, but 
if it's the first non-header line, it's wrong.

			Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]