Skip to content

Instantly share code, notes, and snippets.

@hSATAC
Created December 15, 2011 10:39
Show Gist options
  • Select an option

  • Save hSATAC/1480667 to your computer and use it in GitHub Desktop.

Select an option

Save hSATAC/1480667 to your computer and use it in GitHub Desktop.
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
@jsleetw
Copy link
Copy Markdown

jsleetw commented Dec 15, 2011

Kevin Luo !!!

@hSATAC
Copy link
Copy Markdown
Author

hSATAC commented Dec 16, 2011

@jsleetw What's wrong with Kevin Luo?

@jsleetw
Copy link
Copy Markdown

jsleetw commented Dec 16, 2011

看到前同事的名子 ~ 真巧

@hSATAC
Copy link
Copy Markdown
Author

hSATAC commented Dec 16, 2011

:P 世界真小

@jsleetw
Copy link
Copy Markdown

jsleetw commented Dec 16, 2011

btw 這是防止其他人在master commit 的hook 嗎?
thats useful

@hSATAC
Copy link
Copy Markdown
Author

hSATAC commented Dec 16, 2011

對,不過這支有點問題
假設 user 一次 push 多個 ref 的時候
pre-receive hook 只會執行一次,所以會把不該擋的擋掉
後來覺得用 update hook 比較好
update hook 是每個 ref 分別執行
就不會擋掉正常的 push
=> https://gist.github.com/1484109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment