Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 214233 Details for
Bug 362363
Better policy ... provide hooks to allow a committer to delete <userid>/branchname branches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
pre-receive script
pre-receive (text/plain), 2.50 KB, created by
Paul Webster
on 2012-04-19 08:14:41 EDT
(
hide
)
Description:
pre-receive script
Filename:
MIME Type:
Creator:
Paul Webster
Created:
2012-04-19 08:14:41 EDT
Size:
2.50 KB
patch
obsolete
>#!/bin/sh > ># ># For each ref, validate the commit. ># >validate_ref() >{ > # --- Arguments > oldrev=$(git rev-parse $1) > newrev=$(git rev-parse $2) > refname="$3" > > # oldrev could be 0s which means creating refname > # newrev could be 0s which means deleting refname > > case "$refname" in > refs/heads/*) > branch=$(expr "$refname" : "refs/heads/\(.*\)") > topicbranch=$(expr "$branch" : "\(.*/.*\)") > topicuser=$(expr "$branch" : "\(.*\)/.*") > if [ 0 -ne $(expr "$newrev" : "0*$") ]; then # deleting > # only topic branches can be deleted > if [ -z $topicbranch ]; then > fail=1 > echo >&2 "*** Deleting the branch $branch is not permitted. ***" > return > fi > if [ "$USER" != "$topicuser" ]; then > fail=1 > echo >&2 "*** Deleting the branch $branch is not permitted by $USER. ***" > return > fi > return # Don't need to validate old revision > else #updating > if [ $oldrev != $(git merge-base $oldrev $newrev) ]; then # non fast-forward > # only topic branches can be non fast-forwarded > if [ -z $topicbranch ]; then > fail=1 > echo >&2 "*** Non fast-forward of branch $branch is not permitted. ***" > return > fi > if [ "$USER" != "$topicuser" ]; then > fail=1 > echo >&2 "*** Non fast-forward of branch $branch is not permitted by $USER. ***" > return > fi > fi > fi > ;; > refs/tags/*) > tag=$(expr "$refname" : "refs/tags/\(.*\)") > topictag=$(expr "$tag" : "\(.*/.*\)") > topicuser=$(expr "$tag" : "\(.*\)/.*") > if [ 0 -ne $(expr "$newrev" : "0*$") ]; then # deleting > # only topic tags can be deleted > if [ -z $topictag ]; then > fail=1 > echo >&2 "*** Deleting the tag $tag is not permitted. ***" > return > fi > if [ "$USER" != "$topicuser" ]; then > fail=1 > echo >&2 "*** Deleting the tag $tag is not permitted by $USER. ***" > return > fi > return > fi > ;; > *) > fail=1 > echo >&2 "*** pre-receive hook does not understand ref $refname in this repository. ***" > echo >&2 "*** Contact the repository administrator. ***" > ;; > esac >} > >fail="" > ># Allow dual mode: run from the command line just like the update hook, or ># if no arguments are given then run as a hook script >if [ -n "$1" -a -n "$2" -a -n "$3" ]; then > # Output to the terminal in command line mode - if someone wanted to > # resend an email; they could redirect the output to sendmail > # themselves > PAGER= validate_ref $2 $3 $1 >else > while read oldrev newrev refname > do > validate_ref $oldrev $newrev $refname > done >fi > >if [ -n "$fail" ]; then > exit $fail >fi >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 362363
:
206206
|
214233
|
214491
|
225214