我可以在接收前挂钩中获取正在推送到远程存储库的文件的列表吗? [英] Can I, in the pre-receive hook, get a list of files that are being pushed to the remote repository?

查看:44
本文介绍了我可以在接收前挂钩中获取正在推送到远程存储库的文件的列表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个 pre-receive 钩子脚本,以获取有关被推送到服务器中的文件的信息.

I need to write a pre-receive hook script which get the information about the files that are being pushed into the server.

我想知道是否可以通过远程存储库中存在的脚本来获取被推送到远程存储库中的文件列表

I want to know if the list of files that are being pushed into the remote repository can be obtained by a script present in the remote repository

有关信息,我需要访问这些文件以便对其进行一些代码样式检查.

For information, I need to access these files in order to perform some code style checks on them.

推荐答案

在该钩子的服务器上,您将传入ref,旧sha和新sha.只需使用 git diff --name-only old..new 从挂钩中获取文件列表

On the server for that hook you are passed in a ref and an old sha and a new sha. Just use git diff --name-only old..new to get the file list from within the hook

这篇关于我可以在接收前挂钩中获取正在推送到远程存储库的文件的列表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆