tarmolov / git-hooks-js

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

Never run git-ignored hooks, regardless of permissions #31

Closed codebling closed 7 years ago

codebling commented 7 years ago

Fixes #30.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.3%) to 93.805% when pulling 2d6260ff717fc94a9fdb44570d9a03503e330676 on codebling:git-ignore into 069d80a9399ebe531563e2234cc83d1abb1b8ef4 on tarmolov:master.

tarmolov commented 7 years ago

I didn't get an issue which you try to solve with this pr.

codebling commented 7 years ago

Consider the test on line 121 of run.test.js.

describe('do not run git-ignored scripts from hooks directory',
    it('should ignore file with wrong permissions in hooks directory',

What is this testing? Files with wrong permissions will not be run, so this test is really a duplicate of the test on line 46, and so nothing related to git-ignored files is tested.

In fact, git-ignored files will often still be executed, if they are using non-trivial paths or if there is more than one git-ignored file in the git repository. See #30.

This PR ensures that git-ignored files are never executed, and that this functionality will also work on Windows.

codebling commented 7 years ago

Feel free to make changes as you see fit. I have this repo set up on a Windows env and several tests fail without Windows support.

tarmolov commented 7 years ago

Fixed in #41