我想检查 Gitlab CI 中 git 分支中更改的预提交文件。--from-ref我需要使用什么参数?
pre-commit run --from-ref=? --to-ref=HEAD
Run Code Online (Sandbox Code Playgroud)
文档中的示例pre-commit会引发错误。
$ pre-commit run --from-ref=origin/HEAD --to-ref HEAD
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', 'diff', '--name-only', '--no-ext-diff', '-z', 'origin/HEAD...HEAD')
return code: 128
expected return code: 0
stdout: (none)
stderr:
fatal: ambiguous argument 'origin/HEAD...HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Run Code Online (Sandbox Code Playgroud)