[sysadmin-bin] Tabs to spaces, indent fixes
- From: Andrea Veri <averi src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Tabs to spaces, indent fixes
- Date: Fri, 10 Sep 2021 10:02:02 +0000 (UTC)
commit 978a722a75f97b368f25383d50dea791284055e5
Author: Andrea Veri <averi redhat com>
Date: Fri Sep 10 11:41:58 2021 +0200
Tabs to spaces, indent fixes
git/pre-receive-check-policy | 552 +++++++++++++++++++++----------------------
1 file changed, 276 insertions(+), 276 deletions(-)
---
diff --git a/git/pre-receive-check-policy b/git/pre-receive-check-policy
index a4a752e..088a7cc 100755
--- a/git/pre-receive-check-policy
+++ b/git/pre-receive-check-policy
@@ -25,63 +25,63 @@ check_commit() {
email="$(git log $commit -1 --pretty=format:%ae)"
case "$email" in
- *localhost.localdomain|*\(none\))
- if ! forced ; then
- cat <<- EOF >&2
- ---
- The commits you are trying to push contain the author email
- address '$email'. Please configure your
- username and email address. See:
-
- https://wiki.gnome.org/Git/Help/AuthorEmail
-
- For instructions about how to do this and how to fix your
- existing commits.
- ---
- EOF
- exit 1
- fi
- ;;
+ *localhost.localdomain|*\(none\))
+ if ! forced ; then
+ cat <<- EOF >&2
+ ---
+ The commits you are trying to push contain the author email
+ address '$email'. Please configure your
+ username and email address. See:
+
+ https://wiki.gnome.org/Git/Help/AuthorEmail
+
+ For instructions about how to do this and how to fix your
+ existing commits.
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
esac
subject="$(git log $commit -1 --pretty=format:%s)"
if expr "$subject" : ".*Merge branch.*of.*\(git\|ssh\):" > /dev/null 2>&1; then
- if ! forced ; then
- cat <<- EOF >&2
- ---
- The commit:
-
- EOF
- git log $commit -1 >&2
- cat <<- EOF >&2
-
- Looks like it was produced by typing 'git pull' without the --rebase
- option when you had local changes. Running 'git pull --rebase' now
- will fix the problem. Then please try, 'git push' again. Please see:
-
- https://wiki.gnome.org/Git/Help/ExtraMergeCommits
- ---
- EOF
- exit 1
- fi
+ if ! forced ; then
+ cat <<- EOF >&2
+ ---
+ The commit:
+
+ EOF
+ git log $commit -1 >&2
+ cat <<- EOF >&2
+
+ Looks like it was produced by typing 'git pull' without the --rebase
+ option when you had local changes. Running 'git pull --rebase' now
+ will fix the problem. Then please try, 'git push' again. Please see:
+
+ https://wiki.gnome.org/Git/Help/ExtraMergeCommits
+ ---
+ EOF
+ exit 1
+ fi
fi
body="$(git log $commit -1 --pretty=format:%b)"
if expr "$body" : ".*FIXME: need commit message" > /dev/null 2>&1; then
- if ! forced ; then
- cat <<- EOF >&2
- ---
- The commit:
-
- EOF
- git log $commit -1 >&2
- cat <<- EOF >&2
-
- Was created by git-bz from a plain diff. Please edit the commit message
- to properly describe the commit using 'git commit --amend' or
- (for an older commit) 'git rebase -i'. Then try 'git push' again.
- EOF
- exit 1
+ if ! forced ; then
+ cat <<- EOF >&2
+ ---
+ The commit:
+
+ EOF
+ git log $commit -1 >&2
+ cat <<- EOF >&2
+
+ Was created by git-bz from a plain diff. Please edit the commit message
+ to properly describe the commit using 'git commit --amend' or
+ (for an older commit) 'git rebase -i'. Then try 'git push' again.
+ EOF
+ exit 1
fi
fi
@@ -94,244 +94,244 @@ check_ref_update() {
change_type=update
if expr $oldrev : "^0\+$" > /dev/null 2>&1; then
- change_type=create
+ change_type=create
fi
if expr $newrev : "^0\+$" > /dev/null 2>&1; then
- if [ x$change_type = xcreate ] ; then
- # Deleting an invalid ref, allow
- return 0
- fi
- change_type=delete
+ if [ x$change_type = xcreate ] ; then
+ # Deleting an invalid ref, allow
+ return 0
+ fi
+ change_type=delete
fi
case $refname in
- refs/heads/*)
- # Branch update
- branchname=${refname#refs/heads/}
-
- is_wip=false
- is_protected=false
- case $branchname in
- wip/*) is_wip=true ;;
- gnome-*) is_protected=true ;;
- gimp-*) is_protected=true ;;
- "$mainline") is_protected=true ;;
+ refs/heads/*)
+ # Branch update
+ branchname=${refname#refs/heads/}
+ is_wip=false
+ is_protected=false
+
+ case $branchname in
+ wip/*) is_wip=true ;;
+ gnome-*) is_protected=true ;;
+ gimp-*) is_protected=true ;;
+ "$mainline") is_protected=true ;;
+ esac
+
+ range=
+ case $change_type in
+ create)
+ if [ "x$branchname" = xHEAD ] ; then
+ cat <<- EOF >&2
+ ---
+ You are trying to push the branch 'HEAD'.
+ ---
+ EOF
+ exit 1
+ fi
+ range="$newrev"
+ ;;
+ delete)
+ # We really don't like to allow deleting any branch, but
+ # people need to do it to clean up accidentally pushed
+ # branches. Deleting protected branches, however, has no
+ # purpose other than getting around the no-fast-forward
+ # restrictions
+ if [ "$is_protected" = true ] ; then
+ cat <<- EOF >&2
+ ---
+ You are trying to delete a protected branch.
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
+ update)
+ range="$oldrev..$newrev"
+ nonfastforward=false
+ if [ "`git merge-base $oldrev $newrev`" != $oldrev ]; then
+ # Non-fast-forward update. Right now we have
+ # receive.denyNonFastforwards in the git configs for
+ # our repositories anyways, but catching it here would
+ # allow overriding without having to change the config
+ # temporarily.
+ if [[ "$is_protected" = true ]]; then
+ nonfastforward=true
+ fi
+ fi
+
+ if [ "$nonfastforward" = true ] ; then
+ cat <<- EOF >&2
+ ---
+ You are trying to update the branch '$branchname' in a way that is not
+ a fast-forward update. Please see:
+
+ https://wiki.gnome.org/Git/Help/NonFastForward
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
esac
- range=
- case $change_type in
- create)
- if [ "x$branchname" = xHEAD ] ; then
- cat <<- EOF >&2
- ---
- You are trying to push the branch 'HEAD'.
- ---
- EOF
- exit 1
- fi
- range="$newrev"
- ;;
- delete)
- # We really don't like to allow deleting any branch, but
- # people need to do it to clean up accidentally pushed
- # branches. Deleting protected branches, however, has no
- # purpose other than getting around the no-fast-forward
- # restrictions
- if [ "$is_protected" = true ] ; then
- cat <<- EOF >&2
- ---
- You are trying to delete a protected branch.
- ---
- EOF
- exit 1
- fi
- ;;
- update)
- range="$oldrev..$newrev"
- nonfastforward=false
- if [ "`git merge-base $oldrev $newrev`" != $oldrev ]; then
- # Non-fast-forward update. Right now we have
- # receive.denyNonFastforwards in the git configs for
- # our repositories anyways, but catching it here would
- # allow overriding without having to change the config
- # temporarily.
- if [[ "$is_protected" = true ]]; then
- nonfastforward=true
- fi
- fi
-
- if [ "$nonfastforward" = true ] ; then
- cat <<- EOF >&2
- ---
- You are trying to update the branch '$branchname' in a way that is not
- a fast-forward update. Please see:
-
- https://wiki.gnome.org/Git/Help/NonFastForward
- ---
- EOF
- exit 1
- fi
- ;;
- esac
+ # For new commits introduced with this branch update, we want to run some
+ # checks to catch common mistakes.
+ #
+ # Expression here is same as in post-receive-notify-cia; we take
+ # all the branches in the repo, as "^/ref/heads/branchname", other than the
+ # branch we are actualy committing to, and exclude commits already on those
+ # branches from the list of commits between $oldrev and $newrev.
- # For new commits introduced with this branch update, we want to run some
- # checks to catch common mistakes.
- #
- # Expression here is same as in post-receive-notify-cia; we take
- # all the branches in the repo, as "^/ref/heads/branchname", other than the
- # branch we are actualy committing to, and exclude commits already on those
- # branches from the list of commits between $oldrev and $newrev.
-
- if [ -n "$range" ] ; then
- for merged in $(git rev-parse --symbolic-full-name --not --branches | \
+ if [ -n "$range" ] ; then
+ for merged in $(git rev-parse --symbolic-full-name --not --branches | \
egrep -v "^\^$refname$" | \
- git rev-list --reverse --stdin "$range"); do
- check_commit $merged
- done
- fi
- ;;
- refs/tags/*)
- # Tag update
- tagname=${refname#refs/tags/}
-
- case $change_type in
- create)
- object_type=`git cat-file -t $newrev`
- case $object_type in
- commit)
- # Lightweight tag; we allow an import containing these
- # tags, but forbid them in general
- if ! forced ; then
- cat <<- EOF >&2
- ---
- You are trying to push the lightweight tag '$tagname'. You should
either
- make use of a signed (-s) or annotated tag (-a) instead. More details
at:
-
- https://wiki.gnome.org/Git/Help/LightweightTags
- ---
- EOF
- exit 1
- fi
- ;;
- tag)
- # Annotated tag
- if [ "${tagname}" = "HEAD" ]; then
- cat <<- EOF >&2
- ---
- You are trying to push a tag named '$tagname'. This
is not allowed.
- ---
- EOF
- exit 1
- fi
- ;;
- *)
- # git is happy to allow tagging random objects, we aren't
- cat <<- EOF >&2
- ---
- You are trying to push the tag '$tagname', which points to an
object
- of type $object_type. (It should point to a commit or tag
object.)
- ---
- EOF
- exit 1
- ;;
- esac
- ;;
- delete)
- # Deleting a tag is probably someone trying to work-around
- # not being able to update a tag. Disallowing lightweight
- # tags will cut down on accidentally pushing tags called 'list'
- # or whatever. An exception to above rule is deleting tag named
+ git rev-list --reverse --stdin "$range"); do
+ check_commit $merged
+ done
+ fi
+ ;;
+ refs/tags/*)
+ # Tag update
+ tagname=${refname#refs/tags/}
+
+ case $change_type in
+ create)
+ object_type=`git cat-file -t $newrev`
+ case $object_type in
+ commit)
+ # Lightweight tag; we allow an import containing these
+ # tags, but forbid them in general
+ if ! forced ; then
+ cat <<- EOF >&2
+ ---
+ You are trying to push the lightweight tag '$tagname'. You should either
+ make use of a signed (-s) or annotated tag (-a) instead. More details at:
+
+ https://wiki.gnome.org/Git/Help/LightweightTags
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
+ tag)
+ # Annotated tag
+ if [ "${tagname}" = "HEAD" ]; then
+ cat <<- EOF >&2
+ ---
+ You are trying to push a tag named '$tagname'. This is not allowed.
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
+ *)
+ # git is happy to allow tagging random objects, we aren't
+ cat <<- EOF >&2
+ ---
+ You are trying to push the tag '$tagname', which points to an object
+ of type $object_type. (It should point to a commit or tag object.)
+ ---
+ EOF
+ exit 1
+ ;;
+ esac
+ ;;
+ delete)
+ # Deleting a tag is probably someone trying to work-around
+ # not being able to update a tag. Disallowing lightweight
+ # tags will cut down on accidentally pushing tags called 'list'
+ # or whatever. An exception to above rule is deleting tag named
# HEAD. There are some projects which created such tag before
# rejecting its creation was added to policy.
- if ! forced && [ 'x'"$tagname" != 'xHEAD' ] ; then
- cat <<- EOF >&2
- ---
- You are trying to delete the tag '$tagname'.
-
- https://wiki.gnome.org/Git/Help/TagUpdates
- ---
- EOF
- exit 1
- fi
- ;;
- update)
- if ! forced ; then
- cat <<- EOF >&2
- ---
- You are trying to replace the tag '$tagname' with a new tag. Please see:
-
- https://wiki.gnome.org/Git/Help/TagUpdates
- ---
- EOF
- exit 1
- fi
- ;;
- esac
- ;;
- refs/remotes/*)
- # Remote tracking branch
- cat <<- EOF >&2
- ---
- You are trying to push the remote tracking branch:
-
- $refname
-
- to $server.
- ---
- EOF
- exit 1
- ;;
- refs/notes/*)
- # notes (addendums to existing commits)
- notename=${refname#refs/notes/}
-
- case $change_type in
- create)
- ;;
- delete)
- if [ "x$notename" = xcommits ] ; then
- cat <<- EOF >&2
- ---
- You are trying to delete the note 'commits'.
- ---
- EOF
- exit 1
- fi
- ;;
- update)
- if [ "`git merge-base $oldrev $newrev`" != $oldrev ] && ! forced ; then
- # Non-fast-forward update. Right now we have
- # receive.denyNonFastforwards in the git configs for
- # our repositories anyways, but catching it here would
- # allow overriding without having to change the config
- # temporarily.
- cat <<- EOF >&2
- ---
- You are trying to update the note '$notename' in a way that is not
- a fast-forward update. Please see:
-
- https://wiki.gnome.org/Git/Help/NonFastForward
- ---
- EOF
- exit 1
- fi
- ;;
- esac
- ;;
- *)
- # Something else
- cat <<- EOF >&2
- ---
- You are trying to push the ref:
-
- $refname
-
- to $server. This is not a branch or tag.
- ---
- EOF
- exit 1
- ;;
+ if ! forced && [ 'x'"$tagname" != 'xHEAD' ] ; then
+ cat <<- EOF >&2
+ ---
+ You are trying to delete the tag '$tagname'.
+
+ https://wiki.gnome.org/Git/Help/TagUpdates
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
+ update)
+ if ! forced ; then
+ cat <<- EOF >&2
+ ---
+ You are trying to replace the tag '$tagname' with a new tag. Please see:
+
+ https://wiki.gnome.org/Git/Help/TagUpdates
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
+ esac
+ ;;
+ refs/remotes/*)
+ # Remote tracking branch
+ cat <<- EOF >&2
+ ---
+ You are trying to push the remote tracking branch:
+
+ $refname
+
+ to $server.
+ ---
+ EOF
+ exit 1
+ ;;
+ refs/notes/*)
+ # notes (addendums to existing commits)
+ notename=${refname#refs/notes/}
+
+ case $change_type in
+ create)
+ ;;
+ delete)
+ if [ "x$notename" = xcommits ] ; then
+ cat <<- EOF >&2
+ ---
+ You are trying to delete the note 'commits'.
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
+ update)
+ if [ "`git merge-base $oldrev $newrev`" != $oldrev ] && ! forced ; then
+ # Non-fast-forward update. Right now we have
+ # receive.denyNonFastforwards in the git configs for
+ # our repositories anyways, but catching it here would
+ # allow overriding without having to change the config
+ # temporarily.
+ cat <<- EOF >&2
+ ---
+ You are trying to update the note '$notename' in a way that is not
+ a fast-forward update. Please see:
+
+ https://wiki.gnome.org/Git/Help/NonFastForward
+ ---
+ EOF
+ exit 1
+ fi
+ ;;
+ esac
+ ;;
+ *)
+ # Something else
+ cat <<- EOF >&2
+ ---
+ You are trying to push the ref:
+
+ $refname
+
+ to $server. This is not a branch or tag.
+ ---
+ EOF
+ exit 1
+ ;;
esac
return 0
@@ -341,7 +341,7 @@ if [ $# = 3 ] ; then
check_ref_update $@
else
while read oldrev newrev refname; do
- check_ref_update $oldrev $newrev $refname
+ check_ref_update $oldrev $newrev $refname
done
fi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]