tarmolov / git-hooks-js

A tool to manage and run project git hooks
167 stars 30 forks source link

use git ignore rules to skip hooks #14

Closed nik-kor closed 8 years ago

tarmolov commented 8 years ago

Now you probably start hating me ^^

I think .githooksignore should absolutely the same as original .gitignore because git-hooks and git are tightly connected and tangled ;)

Guria commented 8 years ago

@tarmolov +1 @nik-kor the best place to store such ignores (os, editor specific) is your global .gitttgnore

https://help.github.com/articles/ignoring-files/#create-a-global-gitignore

nik-kor commented 8 years ago

@tarmolov I hate you. No, just joking)

yeah, it's a good idea to use global ignore settings. Have to figure out how to extract them because they can be anywhere and I, probably, should analyze git settings

Guria commented 8 years ago

@nik-kor why ever need to extract it. Just manage it on your own machine.

nik-kor commented 8 years ago

@Guria because I want to teach git-hooks to ignore some files inside git-hooks/ folders.

Guria commented 8 years ago

Aren't githooks already ignores all that ignored by git just from its nature?

nik-kor commented 8 years ago

No, it isn't.) I mean this https://github.com/tarmolov/git-hooks-js/blob/master/lib/git-hooks.js#L109 should be teached to ignore some stuff from .githooks

tarmolov commented 8 years ago

Let's use git-check-ignore to check path before execution hook. It seems it'll solve the issue and you don't need to add a separate .githooksignore.

$ git check-ignore -q node_modules/.bin/mocha
$ echo $?
0
$ git check-ignore -q bin/git-hooks
$ echo $?
1
nik-kor commented 8 years ago

have to check while it is not working in node 0.10....(

tarmolov commented 8 years ago

Just a couple of remarks and I'm ready to merge it :)

nik-kor commented 8 years ago

rebased it.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.4%) to 95.146% when pulling 490addde58a92ad05d04901feae2bdf66efa967c on nik-kor:master into 690aff09e2e9108a03988be4513b500ffc6e53fa on tarmolov:master.

tarmolov commented 8 years ago

Thank you

nik-kor commented 8 years ago

Thank you too! I knew some stuff doing this tiny PR)