tarmolov / git-hooks-js

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

Pass standard input through to all hooks #28

Closed getsnoopy closed 7 years ago

getsnoopy commented 7 years ago

Some git hooks can be passed additional information through standard input (e.g., the pre-push hook), so this commit handles that properly. Since stream data can be consumed only once but multiple hooks may need to use it, capture the stream data once and pipe it to each child process individually.

Fixes #26

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.09%) to 95.238% when pulling 7df937f4fbec01c0f79f4be3c66b7d19ab08d075 on getsnoopy:master into 069d80a9399ebe531563e2234cc83d1abb1b8ef4 on tarmolov:master.

getsnoopy commented 7 years ago

I added an extra test in there that checks to see if everything works properly even if no input is passed in via STDIN.

tarmolov commented 7 years ago

Sorry for delay.

I was thinking about this pr. It makes the tool more complicated and even fragile because of async behavior. So, I decided to decline supporting such feature for a while.

Thank you for your help and your time. I very appreciate that and sorry for bad news : - /

getsnoopy commented 7 years ago

Hey @tarmolov, I'm wondering how you feel about this feature now. We really need this, since we need the hook scripts to be able to see where commits are being pushed in the pre-push hook for example. There's no alternative to it at the moment.

getsnoopy commented 6 years ago

@tarmolov, any update on this?

tarmolov commented 6 years ago

Nothing was changed since https://github.com/tarmolov/git-hooks-js/pull/28#issuecomment-259950000

However, maybe husky works better for you. It is supported GIT_STDIN variable which you're looking for. https://github.com/typicode/husky/pull/253

getsnoopy commented 6 years ago

Thanks, I'll look into it.