unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: Checking in files with trailing white space
Date: Mon, 12 Dec 2016 22:16:42 +0000	[thread overview]
Message-ID: <20161212221642.GA4361@acm.fritz.box> (raw)
In-Reply-To: <m3pokye1wa.fsf@gnus.org>

Hello, Lars.

On Sun, Dec 11, 2016 at 07:50:13PM +0100, Lars Ingebrigtsen wrote:
> Alan Mackenzie <acm@muc.de> 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).



  reply	other threads:[~2016-12-12 22:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-20 12:55 Checking in files with trailing white space Lars Magne Ingebrigtsen
2016-03-20 13:08 ` Lars Magne Ingebrigtsen
2016-12-11 13:31   ` Alan Mackenzie
2016-12-11 18:50     ` Lars Ingebrigtsen
2016-12-12 22:16       ` Alan Mackenzie [this message]
2016-12-12 22:57         ` Paul Eggert
2016-12-13  3:32           ` Eli Zaretskii
2016-12-13  7:31             ` Paul Eggert
2016-12-13 16:01               ` Eli Zaretskii
2016-12-13 18:33                 ` Paul Eggert
2016-12-13 19:00                   ` Eli Zaretskii
2016-12-13 22:39                     ` Paul Eggert
2016-12-14  3:31                       ` Eli Zaretskii
2016-12-14  7:47                         ` Paul Eggert
2016-12-14 15:32                           ` Eli Zaretskii
2016-12-14 18:15                             ` Paul Eggert
2016-12-14 19:26                               ` Eli Zaretskii
2016-12-13 18:28           ` Alan Mackenzie
2016-12-13 18:39             ` Paul Eggert
2016-03-21 13:10 ` Stefan Monnier
2016-03-21 13:59   ` Lars Magne Ingebrigtsen
2016-03-21 18:09     ` Paul Eggert
2016-04-04 20:05       ` Lars Magne Ingebrigtsen
2016-04-04 21:55         ` Paul Eggert
2016-04-24 13:13           ` Lars Magne Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=20161212221642.GA4361@acm.fritz.box \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).