我想限制那些提交具有特定提交消息格式的人,我该怎么做?
例如: Pair_Name|Story_Number|Commit_Message
我在git中有一个尚未解决的分支,SHA1 0000000000000000000000000000000000000000(全为零),这是正常的还是我损坏了git存储库?
请不要回答是,在2 ^ 160或0.00000000000000000000000000000000000000000000006842277657836021%概率中有一个具有该SHA1.
我是相当安全的,我不是个幸运的家伙谁在他的git仓库得到了0000000000000000000000000000000000000000的SHA1.
我正在尝试编写服务器端预接收git挂钩来评估提交时的提交.
根据这里的答案,通过搜索git日志并使用'format:'过滤掉我想要的内容,这很容易实现.
我创建了以下预提交脚本.
#!/bin/bash
set -x #for debugging, TODO: remove
echo "parameters are" $@
echo "1 is " $1
#List of banned users
bannedusers=( root )
author_name=$(git show --pretty=oneline --pretty=format:%an | head -n1)
author_email=$(git show --pretty=oneline --pretty=format:%ae | head -n1)
committer_name=$(git show --pretty=oneline --pretty=format:%cn | head -n1)
committer_email=$(git show --pretty=oneline --pretty=format:%ce | head -n1)
commit_users=( "${author_name}" "${committer_name}" )
for acommituser in "${commit_users[@]}"
do
:
echo $acommituser #for debugging, TODO: remove
for abanneduser in "${bannedusers[@]}"
do
: …Run Code Online (Sandbox Code Playgroud)