git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Git Mailing List" <git@vger.kernel.org>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Lukas Sandström" <lukass@etek.chalmers.se>
Subject: 'git mailinfo' whitespace bug
Date: Thu, 18 Feb 2010 10:05:27 -0800 (PST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1002180936240.4141@localhost.localdomain> (raw)


'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

             reply	other threads:[~2010-02-18 18:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 18:05 Linus Torvalds [this message]
2010-02-19 11:54 ` [PATCH] mailinfo: don't trim whitespace in the commit message Lukas Sandström
2010-02-20  5:51 ` 'git mailinfo' whitespace bug Junio C Hamano
2010-02-22 15:13   ` Don Zickus
2010-02-22 19:57     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.1002180936240.4141@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=lukass@etek.chalmers.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).