feat: unset core.hookspath in lefthook install#1292
feat: unset core.hookspath in lefthook install#1292mrexox merged 2 commits intoevilmartians:masterfrom
Conversation
internal/command/install.go
Outdated
| if !force { | ||
| return formatHooksPathError(local, global) | ||
| } | ||
|
|
||
| // If force is true, warns and unsets the conflicting configurations. | ||
| if hasLocal { | ||
| log.Warnf("core.hooksPath is set locally to '%s'.", local) | ||
| } | ||
| if hasGlobal { | ||
| log.Warnf("core.hooksPath is set globally to '%s'.", global) | ||
| } | ||
|
|
||
| return l.unsetHooksPathConfig(local, global) |
There was a problem hiding this comment.
I would like --force to anyway install into global/local hooks path. Let users decide what they want, maybe they want lefthook to install hooks into the global hooks path? I understand that it might be a controversal approach, but I wouldn't like to limit users. What I learn every time is that the use cases of lefthook are quite wide, so I sometimes can't even imagine them.
mrexox
left a comment
There was a problem hiding this comment.
Awesome! Thank you a lot for adding test. Will merge this and prepare the release
|
We're running into some problems with this -- can the new behavior be configured or suppressed? Any advice on how to deal with it? |
|
Hello @corsonknowles, can you elaborate please ? |
We now have a plan in place to handle this upgrade.
I don't think we need anything else at this time, thank you for your time! |
Closes #1248
Context
See the issue.
Now
lefthook installfail and warn loudly when either the local or global core.hooksPath is set.lefthook installcan unset it automatically using--force--reset-hooks-path.Changes
Using

git config:Using

--reset-hooks-path:Using

--force: