[英]Are pre-commit hooks clonable?
I was reading PEP8:我正在阅读 PEP8:
a backslash followed by a space and a newline does not count as a line continuation marker.
反斜杠后跟空格和换行符不算作行继续标记。 Some editors don't preserve it and many projects (like CPython itself) have pre-commit hooks that reject it .
一些编辑器不保留它,许多项目(如 CPython 本身)都有拒绝它的预提交钩子。
Resorting to the community, I thought pre-commit hooks weren't pushable/clonable.诉诸社区,我认为预提交钩子不可推送/克隆。
How can CPython have pre-commit hooks if this is true ?如果这是真的,CPython 如何有预提交钩子?
(A naive question perhaps) (也许是个幼稚的问题)
Git hooks are client-side or server-side. Git 钩子是客户端或服务器端。 Please note that
请注意
It's important to note that client-side hooks are not copied when you clone a repository.
需要注意的是,克隆存储库时不会复制客户端挂钩。 If your intent with these scripts is to enforce a policy, you'll probably want to do that on the server side source
如果您使用这些脚本的目的是强制执行某个策略,则您可能希望在服务器端源代码上执行此操作
The distinction is based on the type of operation being performed:区别基于正在执行的操作类型:
Client-side hooks are triggered by operations such as committing and merging, while server-side hooks run on network operations such as receiving pushed commits.
客户端钩子由提交和合并等操作触发,而服务器端钩子运行在网络操作上,例如接收推送提交。
pre-commit hooks are client-side, thus not clonable as you correctly state.预提交钩子是客户端的,因此不能像您正确声明的那样克隆。 I find this discussion on why that would also be a large security risk.
我发现这个讨论是关于为什么这也会是一个很大的安全风险。
However, regarding PEP8 I believe this page is holding the answer.但是,关于 PEP8,我相信这个页面给出了答案。 The pre-commit scripts are created locally from the repository on your machine (and, of course, can be bypassed).
预提交脚本是从您机器上的存储库本地创建的(当然,可以绕过)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.