bahmutov / pre-git

Automatically install pre-commit / pre-push hooks in your git repo
168 stars 22 forks source link

fix: when no package.json found, bail out instead of throwing #118

Closed fluffynuts closed 6 years ago

fluffynuts commented 6 years ago

When installing pre-git into a pre-existing git repository, when the team works with a feature-branch strategy like git-flow or similar, switching between branches which have a package.json and branches which do not (yet) fails because the incoming branch has not had package.json merged in. Hooks are fired irrespective of branch, so this patch is simply to log a warning when unable to find package.json so that the checkout can complete successfully.

I've just had several instances of this -- it's a problem which will eventually go away, but, in the meantime, or for any other project busy with integrating pre-git, a missing package.json should rather result in a warning than a broken checkout which leaves the client repo in a detached state.

fluffynuts commented 6 years ago

@bahmutov I've fixed the last hinting errors Travis was complaining about, but the Travis build still seems to think it has those errors. I'd really appreciate it if you could help here -- I think that this PR has value, but it's just sitting here ):

fluffynuts commented 6 years ago

@bahmutov PR has been open for 28 days and it's just cluttering my PR view; please take a moment to review. I'll delete if not reviewed within a week or so -- having outstanding PRs in my list makes it more difficult for me to grok when I have work to do.

fluffynuts commented 6 years ago

I'm closing this. @bahmutov if you come back here and decide that the contribution may have been useful, please contact me. My company works on GitHub -- this is just another PR cluttering my work view.