From: Junio C Hamano Date: Tue, 11 Nov 2008 17:13:18 GMT Subject: Re: git commit -v does not removes the patch Message-ID: <7v4p2e2nkg.fsf@gitster.siamese.dyndns.org> In-Reply-To: <20081111102914.GA30330@coredump.intra.peff.net> Jeff King writes: > But I have to wonder if there is some more robust solution. It seems > like this can have false positives if you include diff output in your > commit message, and a potential false negative if you delete the newline > (e.g., delete everything up to "diff --git", making it the first line). Actually, I recall (from my googling quite some time ago) people noticing this, but they learnt to live with it. We may want to change this. We can say "# Everything under this line is deleted." at the beginning of the "#" block we produce in the commit log message editor, replacing the "Lines starting with '#' will be ignored, " we currently have. When reading back the editor result, make "git commit -v" scan for the "# Everything ..." line. We remove it and everything that follows, but we do not touch anything above that line (including the ones that begin with "diff" or "#") except the usual trailing whitespace removal. That way, people can leave a sample shell session with root prompt, and sample diff, in their message. If we do not see "# Everything ..." when we read it back, we can do what we currently do as a fallback.