名称

pre-lock — 路径锁定尝试的通知。

描述

pre-lock 钩子在每次有人尝试锁定文件时执行。可以防止完全锁定,或者用来创建控制哪些用户可以锁定哪些路径的复杂策略。如果钩子发现已存在锁,也可以决定是否允许用户窃取这个锁。

如果 pre-lock 钩子返回非零值,锁定动作会终止,任何输出到 stderr 的内容都会返回到客户端。

The hook program may optionally dictate the lock token which will be assigned to the lock by printing the desired lock token to standard output. Because of this, implementations of this hook should carefully avoid unexpected output sent to standard output.

[警告] 警告

If the pre-lock script takes advantage of lock token dictation feature, the responsibility of generating a unique lock token falls to the script itself. Failure to generate unique lock tokens may result in undefined—and very likely, undesired—behavior.

输入参数

传递给你钩子程序的命令行参数,按照顺序是:

  1. 版本库路径

  2. 将要锁定的版本化路径

  3. 尝试锁定的认证用户名

  4. Comment provided when the lock was created

  5. 1 if the user is attempting to steal an existing lock; 0 otherwise

普通用户

访问控制