Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人可以共享一个“原点”侧钩子来检查收到的提交是否引入了错误的空白字符(在我的情况下是选项卡)并拒绝该推送?
我不能预先提交,因为我团队中有一些人,嗯......哦,没关系。;)
正确的地方是update钩子。我还没有测试过,但是这样的东西应该可以工作:
update
#!/bin/sh branch=$1 oldrev=$2 newrev=$3 if git diff $oldrev..$newrev | grep -P '\+.*\t'; then echo When updating ref $branch: diff $oldrev..$newrev introduces tabs exit 1 fi