【问题标题】:How does the Gerrit server intercept commits. Looking for technical detailsGerrit 服务器如何拦截提交。寻找技术细节
【发布时间】:2017-02-19 16:38:16
【问题描述】:

我知道 Gerrit 接收 git 提交(可能使用 update 钩子),并将它们写在某处的假 ref 上,直到同行评审完成,但该过程在技术实现方面究竟是如何工作的?以及涉及哪些 Git 命令?

【问题讨论】:

标签: git server gerrit


【解决方案1】:

您可能会引用用户when pushing new commits 使用的魔术引用refs/for/<branch ref>

要创建新的更改以供审核,只需使用任何 Git 客户端工具推送到项目的神奇refs/for/'branch' ref:

git push ssh://sshusername@hostname:29418/projectname HEAD:refs/for/branch

例如john.doe 可以使用 git push 为项目kernel/commonexperimental 分支上传新的更改,托管在git.example.com Gerrit 服务器上:

git push ssh://john.doe@git.example.com:29418/kernel/common HEAD:refs/for/experimental

git push 客户端上传的每一个新提交都会在服务器上转换成一条变更记录。
远程引用 refs/for/experimental 实际上并不是由 Gerrit 创建的,即使客户端的状态消息可能另有说明。


从技术上讲,这是由cmd-receive-pack 管理的。

由“git push”调用并更新项目的存储库 从 'git push' 端提供的信息。

它由 gerrit/sshd/commands/Receive.java 实现,它使用 Git receive-pack protocol 通过 SSH 接收更改上传。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多