mirror of
https://github.com/release-engineering/dist-git.git
synced 2025-02-23 23:12:55 +00:00
git hook: update-block-push-origin
This commit is contained in:
parent
0d044ca214
commit
a412858784
2 changed files with 18 additions and 2 deletions
|
@ -88,6 +88,9 @@ touch %{buildroot}%{_sharedstatedir}/dist-git/gitolite/hooks/common/update
|
|||
|
||||
cp -a scripts/httpd/upload.cgi %{buildroot}%{_sharedstatedir}/dist-git/web/
|
||||
|
||||
cp -a scripts/git/hooks/update-block-push-origin \
|
||||
%{buildroot}%{_sharedstatedir}/dist-git/gitolite/local/VREF/update-block-push-origin
|
||||
|
||||
ln -f -s %{_sysconfdir}/dist-git/gitolite.rc \
|
||||
%{buildroot}%{_sharedstatedir}/dist-git/git/.gitolite.rc
|
||||
|
||||
|
@ -97,8 +100,6 @@ ln -f -s %{_sharedstatedir}/dist-git/gitolite \
|
|||
ln -f -s %{_sharedstatedir}/dist-git/git/rpms \
|
||||
%{buildroot}%{_sharedstatedir}/dist-git/git/repositories
|
||||
|
||||
ln -f -s %{_datadir}/git-core/update-block-push-origin \
|
||||
%{buildroot}%{_sharedstatedir}/dist-git/gitolite/local/VREF/update-block-push-origin
|
||||
|
||||
|
||||
|
||||
|
|
15
scripts/git/hooks/update-block-push-origin
Normal file
15
scripts/git/hooks/update-block-push-origin
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Block pushes to branches if their name starts with `origin/`
|
||||
# https://fedorahosted.org/rel-eng/ticket/4071
|
||||
|
||||
refname="${1}"
|
||||
|
||||
echo "${refname}" | grep -qE '^refs/heads/origin/'
|
||||
|
||||
if [ $? == 0 ]; then
|
||||
echo "Can't push a branch named $refname"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Reference in a new issue