小编vor*_*nin的帖子

如何为 Gitlab 指定预提交 --from-ref ?

我想检查 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)

gitlab gitlab-ci pre-commit.com

5
推荐指数
1
解决办法
1792
查看次数

标签 统计

gitlab ×1

gitlab-ci ×1

pre-commit.com ×1