【发布时间】:2018-11-06 23:50:28
【问题描述】:
我有脚本来阻止未解决的合并冲突被推送:
#!/bin/bash
echo "pre-receive HOOK: $old_sha $new_sha"
while read old_sha new_sha refname
do
if git diff "$old_sha" "$new_sha" | grep -qE '^\+(<<<<<<<|>>>>>>>)'; then
echo "Saw a conflict marker in $(basename "$refname")."
git diff "$old_sha" "$new_sha" | grep -nE '^\+(<<<<<<<|>>>>>>>)'
exit 1
fi
done
exit 0
但是当新分支被推送时,我收到下一条错误消息:
致命:坏对象 0000000000000000000000000000000000000000
完整输出:
Counting objects: 77, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (58/58), done.
Writing objects: 100% (77/77), 11.27 KiB | 5.63 MiB/s, done.
Total 77 (delta 52), reused 14 (delta 6)
remote: pre-receive HOOK
remote: fatal: bad object 0000000000000000000000000000000000000000
To https://tracker.feel-safe.net/gitdev/main.git
* [new branch] 296-ToS-component -> xxx
而且,如您所见,已提交损坏的更改。
如何处理pre-receive钩子中的新分支?
我应该创建update 挂钩吗?
【问题讨论】: