yxliang01 / git-pull-hook

A npm(nodejs) module allows you to add prepull and postpull hook
MIT License
1 stars 0 forks source link

.git/hooks/pre-pull rather than package.json #2

Open temple opened 7 years ago

temple commented 7 years ago

Once looked at the code, it seem to read from package.json the user defined hooks. https://github.com/yxliang01/git-pull-hook/blob/master/src/index.js#L78

But, the "git way" is to deploy script files under .git/hooks directory, as explained here https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

It would be a nice feature, and I suggest doing two things:

yxliang01 commented 7 years ago

Hello temple. Right! This would be a great feature to have! Actually, this was the initial idea for this module. However, .git folder is not versioned by git by default while I found putting the commands to execute when pulling in package.json not only can be versioned automatically but also being able to invoke non-global devDependencies to have portability. I have put this on my TODO list. I am still busy working on something at this moment. Hopefully, this can be implemented in the next 30 days. Thanks for your idea!

yxliang01 commented 7 years ago

I think reading both from package.json and .git/hooks/pre-pull and execute them in this order would be good.

temple commented 7 years ago

As a tip. When I installed git-pull-hook via npm install -g git-pull-hook, and I run gitp for the first time, it did'nt suggest me to create a package.json file, and neither told me where to get a sample one.

First user reaction may be taking a look at it git/hooks folder, cause shouldn't be concious of the need of having a package.json file.

I think more clever way to develop this enhancement, may imply advising the user via console.log to deploy this files when none was found.

Thanks

yxliang01 commented 7 years ago

So, edbc29f added notification for hook that is not found. However, it doesn't say whether package.json is found because I will add support for .git/hooks soon.

Thanks for your advice.