简体   繁体   English

验证git commit在裸仓库中但在工作副本上

[英]Verify git commit in bare repo but on a working copy

i have some verification scripts that need to run on a working copy but this task should be done server side in a pre-receive hook to prevent people to push broken things. 我有一些需要在工作副本上运行的验证脚本,但此任务应在服务器端的预接收挂钩中完成,以防止人们推送损坏的东西。

the problem is now that the server repo is a bare repo, so i can not run the checks directly in there. 现在的问题是服务器存储库是裸存储库,因此我无法直接在其中运行检查。 I thought about checking out a working copy in the pre-receive script but this unfortunately does not work, because the commit is not available in the repo yet... 我曾考虑过在预接收脚本中签出工作副本,但是不幸的是这行不通,因为该提交在存储库中尚不可用...

How can i do this check? 我该如何检查?

Both the pre-receive and the update hook are triggered after transferring the commit, but before updating the refs to the commit. 在传送提交之后但在将引用更新为提交之前,会触发预接收钩子和更新钩子。

Both hooks get the sha1 of the transferred commit as an argument. 两个钩子都将传输的提交的sha1作为参数。 Therefore it should be no problem to check this out into some working copy and do your verification. 因此,将其签入一些工作副本并进行验证应该没有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM