Re: Looking for pre-commit hook to check whitespace errors but not for all files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Paul Menzel <paulepanter@xxxxxxxxxxxxxxxxxxxxx> 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.
        +bar
        foo.txt:1: trailing whitespace.
        +foo
        $ git commit foo.txt
        foo.txt:1: trailing whitespace.
        +foo

> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]