bahmutov / pre-git

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

Remove defaut commit-msg setting #86

Open gabmontes opened 8 years ago

gabmontes commented 8 years ago

When installing pre-git, a default setting for the commit-msg is set. Is there any way to prevent this behavior?

In repos where no such a rule is applied to commit messages, the hook has to be manually disabled editing the package.json after install. Even doing that, the hook can be unintentionally re-enabled by reinstalling the package.

Please advise. Thanks.

bahmutov commented 8 years ago

I think we should not set it if it has been removed manually. But setting the default value helps I think

gabmontes commented 8 years ago

I agree that in some cases will help but in many cases I have run into, and this is the reason behind my question, had to perform clear installs of repos using pre-git and the commit-msg setting is set, despite it was previously removed from package.json.

One option to solve the issue is to split the module's behavior in two: a git hooks piece and a commit message validation piece. If you install the second, have the current full functionality. If only install the first piece, just the hooks. My two cents!

insidewhy commented 7 years ago

Setting the default value feels like overreach for me. I've installed pre-git in about five projects now and never wanted it.

bahmutov commented 7 years ago

Wait, is it installing a hook even if this is a deep nested dependency? In other words, I am ok with it installing git hooks and adding config to the package.json if the package requires pre-git. But if you add a dependency on the package Foo that requires pre-git, you shouldn't get any of these things.

If this is the case (I don't remember now), it is a bad bug = feature.

bahmutov commented 7 years ago

Just tested - if you do NOT install pre-git directly, the Git hooks are not set. The package.json is not updated. Only if you directly install pre-git then you will get the Git hooks and the config object. I do not see how this module can be installed without installing its requirements hooks and configuration object.

insidewhy commented 7 years ago

pre-git should be modular and do one thing well. Commit message validation should be a separate package.

oli commented 7 years ago

Using pre-git for secrets checking here, and have no desire to enforce commit message formatting, so we’re also deleting

"release": {
  "analyzeCommits": "simple-commit-message"
}

from each repo’s package.json after installation, fwiw (yay microservices). Thanks for pre-git by the way!

lirantal commented 6 years ago

Same. TBH, don't even know what that's used for? is that for anyone who might be using semantic-release or standard-version type of modules?