-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use git ignore rules to skip hooks #14
Conversation
Now you probably start hating me ^^ I think |
@tarmolov +1 https://help.github.com/articles/ignoring-files/#create-a-global-gitignore |
@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 |
@nik-kor why ever need to extract it. Just manage it on your own machine. |
@Guria because I want to teach git-hooks to ignore some files inside git-hooks/ folders. |
Aren't githooks already ignores all that ignored by git just from its nature? |
No, it isn't.) |
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 $ git check-ignore -q node_modules/.bin/mocha
$ echo $?
0
$ git check-ignore -q bin/git-hooks
$ echo $?
1 |
3b18946
to
9c2ae27
Compare
have to check while it is not working in node 0.10....( |
@@ -3,6 +3,12 @@ var util = require('util'); | |||
var spawn = require('child_process').spawn; | |||
var fs = require('fs'); | |||
var fsHelpers = require('./fs-helpers'); | |||
var execSync = require('child_process').execSync; | |||
if (!execSync) { | |||
execSync = require('runsync').exec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
External modules are forbidden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, can you explain why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because of npm@2 bug :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I'm dumb, but I haven't catched it yet.)
So the problem you mentioned is with postinstall npm-script?
And here we just reassign variable so polyfilling it.
You mean that this
"preinstall": "if [ $(node -e 'console.log(/0.10/.test(process.version))') = 'true' ]; then npm install runsync; else exit 0; fi"
script is buggy?
So we can just always install runsync module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like this preinstall
script. Let's implement it without an external module. Async version is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we install runsync always?
I just use sync version because this test fails
1) git-hook runner when hooks are found and a hook is unexecutable should return an error:
AssertionError: expected [Function] to throw Error
if you think that async exec will be better than I'll rewrite the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do love sync version but I want to support 0.8
and 0.10
as well without extra modules. Let's make async version.
excludeIgnoredPaths(hooks, function (filteredHooks) {
runHooks(filteredHooks, [arg], callback);
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
Just a couple of remarks and I'm ready to merge it :) |
rebased it. |
Thank you |
Thank you too! |
No description provided.