From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Checking in files with trailing white space Date: Mon, 12 Dec 2016 22:16:42 +0000 Message-ID: <20161212221642.GA4361@acm.fritz.box> References: <20161211133110.GB14084@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1481581071 5110 195.159.176.226 (12 Dec 2016 22:17:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Dec 2016 22:17:51 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 12 23:17:47 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cGYup-0000fV-3R for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 23:17:47 +0100 Original-Received: from localhost ([::1]:33825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGYut-0004WG-El for ged-emacs-devel@m.gmane.org; Mon, 12 Dec 2016 17:17:51 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGYuD-0004WB-IE for emacs-devel@gnu.org; Mon, 12 Dec 2016 17:17:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGYuA-0002KY-C5 for emacs-devel@gnu.org; Mon, 12 Dec 2016 17:17:09 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:12021 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cGYuA-0002KP-1N for emacs-devel@gnu.org; Mon, 12 Dec 2016 17:17:06 -0500 Original-Received: (qmail 35870 invoked by uid 3782); 12 Dec 2016 22:17:02 -0000 Original-Received: from acm.muc.de (p548C78FC.dip0.t-ipconnect.de [84.140.120.252]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 12 Dec 2016 23:17:01 +0100 Original-Received: (qmail 4465 invoked by uid 1000); 12 Dec 2016 22:16:42 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:210381 Archived-At: Hello, Lars. On Sun, Dec 11, 2016 at 07:50:13PM +0100, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > >> > I'm adding test cases for the shr HTML rendering, and in some of the > >> > tests there should really be trailing white space in the result files. > >> > Is there a way to say that the test/data/shr directory should be allowed > >> > to have trailing spaces in our git/checkin thing? > >> Never mind; found it... > > Would some kind soul please tell me the recipe. I've just merged master > > into a nine-month old branch, and I get lots of these whitespace errors > > when I try to commit the merge. > Hm... sorry, I've forgotten again. But I don't think what you're > seeing is related to what I was talking about. The git/checkin script > refuses to check in files with whitespace at the end of lines, while it > sounds like you have something different going on... No, that was precisely my problem. The files with the trailing spaces (there must have been ~30 - 100 of them) might well have been the test files you created, as reported in the paragraph above. However, this absolute prohibition on trailing spaces is fascistic. Some files (for example, test files) have essential trailing spaces in them, and for git absolutely to refuse to commit them I think is unacceptable. I eventually found what was causing the problem, although it cost me a precious 2 - 3 hours out of my Emacs hacking time. :-( This problem was the last line in ..../.git/hooks/pre-commit, which looked like this: exec git diff-index --check --cached HEAD -- . Do you see "trailing spaces" in there anywhere? No, neither did I, and the fact that there's no comment to say so got me somewhat angry after I'd found out. Negligent obfuscation, particularly given the dire state of git's documentation. Anyhow, I've commented out that line, and all the files with trailing spaces got committed OK. It would be nice to get a warning along the lines of "The following files contain trailing whitespace, do you wish to proceed with the commit? [Y/n]: ....". > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).