From: Neal Kreitzinger <nkreitzinger@gmail.com>
To: John Szakmeister <john@szakmeister.net>
Cc: git@vger.kernel.org
Subject: Re: pre-commit hook to reject whitespace
Date: Fri, 03 Jun 2011 19:23:44 -0500 [thread overview]
Message-ID: <4DE97B10.8080006@gmail.com> (raw)
In-Reply-To: <BANLkTi=Gh9CStVkgp5gBs7XzG-dCXB+oUw@mail.gmail.com>
On 6/3/2011 7:12 PM, John Szakmeister wrote:
> On Fri, Jun 3, 2011 at 7:58 PM, Neal Kreitzinger<nkreitzinger@gmail.com> wrote:
>> On 6/3/2011 6:31 PM, Neal Kreitzinger wrote:
>>>
>>> The reference manuals state in the hooks documentation that the pre-commit
>>> hook sample will reject whitespace only changes. However, the
>>> pre-commit.sample in the 1.7.1 and 1.7.5.4 downloads do not appear to do
>>> this (I'm new to linux scripts). The appear to only reject non-ascii
>>> filenames. Does someone have a pre-commit hook example I can use to
>>> reject
>>> whitespace-only changes? Thanks!
>>>
>> As someone kindly pointed out, the documentation actually says:
>> "The default 'pre-commit' hook, when enabled, catches introduction of lines
>> with trailing whitespaces and aborts the commit when such a line is found."
>>
>> I'm not seeing this functionality in the pre-commit.sample for 1.7.1 or
>> 1.7.5.4.
>
> I've never tried that hook script myself, but it appears to be on the last line:
> exec git diff-index --check --cached $against --
>
> In particular, the --check option says:
> Warn if changes introduce trailing whitespace or an indent that
> uses a space before a tab. Exits with non-zero status if problems are
> found. Not compatible with --exit-code.
>
Ah ha! Thanks!
v/r,
neal
prev parent reply other threads:[~2011-06-04 0:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-03 23:31 pre-commit hook to reject whitespace Neal Kreitzinger
2011-06-03 23:58 ` Neal Kreitzinger
2011-06-04 0:12 ` John Szakmeister
2011-06-04 0:23 ` Neal Kreitzinger [this message]
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=4DE97B10.8080006@gmail.com \
--to=nkreitzinger@gmail.com \
--cc=git@vger.kernel.org \
--cc=john@szakmeister.net \
/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).