Created
December 15, 2011 10:39
-
-
Save hSATAC/1480667 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| while read old new name; do | |
| name=$(git log -1 --pretty=format:%aN $new) | |
| branch=$(git rev-parse --symbolic --abbrev-ref $1) | |
| if [ "$branch" == "master" ] | |
| then | |
| if [ "$name" != "Kevin Luo" ] | |
| then | |
| echo "Username $name has no premission to commit branch [$branch]!" | |
| exit 43 | |
| else | |
| exit 0 | |
| fi | |
| fi | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
對,不過這支有點問題
假設 user 一次 push 多個 ref 的時候
pre-receive hook 只會執行一次,所以會把不該擋的擋掉
後來覺得用 update hook 比較好
update hook 是每個 ref 分別執行
就不會擋掉正常的 push
=> https://gist.github.com/1484109