* pre-commit hook to reject whitespace
@ 2011-06-03 23:31 Neal Kreitzinger
2011-06-03 23:58 ` Neal Kreitzinger
0 siblings, 1 reply; 4+ messages in thread
From: Neal Kreitzinger @ 2011-06-03 23:31 UTC (permalink / raw)
To: git
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!
v/r,
neal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pre-commit hook to reject whitespace
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
0 siblings, 1 reply; 4+ messages in thread
From: Neal Kreitzinger @ 2011-06-03 23:58 UTC (permalink / raw)
To: git
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.
v/r,
neal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pre-commit hook to reject whitespace
2011-06-03 23:58 ` Neal Kreitzinger
@ 2011-06-04 0:12 ` John Szakmeister
2011-06-04 0:23 ` Neal Kreitzinger
0 siblings, 1 reply; 4+ messages in thread
From: John Szakmeister @ 2011-06-04 0:12 UTC (permalink / raw)
To: Neal Kreitzinger; +Cc: git
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.
HTH!
-John
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: pre-commit hook to reject whitespace
2011-06-04 0:12 ` John Szakmeister
@ 2011-06-04 0:23 ` Neal Kreitzinger
0 siblings, 0 replies; 4+ messages in thread
From: Neal Kreitzinger @ 2011-06-04 0:23 UTC (permalink / raw)
To: John Szakmeister; +Cc: git
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-06-04 0:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).