Paul Menzel <> writes:

> 1. Only the files actually committed should be checked. That means
> running `git commit -a`, abort that and then running `git commit
> some/file` should only check `some/file` for whitespace errors.

Doesn't hooks/pre-commit.sample we ship already gets this right?

        $ git init foobar && cd foobar
        $ mv .git/hooks/pre-commit.sample .git/hooks/pre-commit
        $ for i in foo bar; do echo $i >$i.txt; done
        $ git commit -m initial
        $ for i in foo bar; do echo "$i " >$i.txt; done
        $ git commit -a
        bar.txt:1: trailing whitespace.
        foo.txt:1: trailing whitespace.
        $ git commit foo.txt
        foo.txt:1: trailing whitespace.

> 2. There are certain files that are allowed to have whitespace errors.

As John Keeping alraedy pointed out, you can use the attributes
mechanism to mark what kind of payload each path has to control
this kind of thing.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to