Skip to content

hjc/so-git-hook-question

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A simple example repo to demonstrate the bug identified by this StackOverflow post.

Getting Started

Link the hooks with:

./bin/link_hooks.sh

Edit file A and add a line with a newline plus trailing whitespace, like so:

printf "asd   \nlklk" >> A

Commit and let the hooks run:

git add A
git commit

You should see this:

<stdin>:8: trailing whitespace.
asd   
<stdin>:32: new blank line at EOF.
+
warning: 2 lines add whitespace errors.

Why is this?