[sysadmin-bin: 61/168] Force the user to use git push --exec=import for importing
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin: 61/168] Force the user to use git push --exec=import for importing
- Date: Thu, 24 May 2012 19:56:34 +0000 (UTC)
commit c69da448393f1a250d27516457bb7f583888e7aa
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Thu Mar 19 19:25:02 2009 -0400
Force the user to use git push --exec=import for importing
If the user does git push without --exec=import to a repository
being imported, or the reverse, display an error message.
gnome-pre-receive | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/gnome-pre-receive b/gnome-pre-receive
index 30a0579..1d03d18 100755
--- a/gnome-pre-receive
+++ b/gnome-pre-receive
@@ -15,6 +15,34 @@ GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
GIT_CONFIG="${GIT_DIR}/config"
export GIT_CONFIG
+# Use the directory name with .git stripped as a short identifier
+absdir=$(cd $GIT_DIR && pwd)
+projectshort=$(basename ${absdir%.git})
+
+# Make sure that the user used --exec=import for importing repositories,
+# and not otherwise. This forces people to be aware of the 'pending'
+# state.
+if [ -e "$GIT_DIR/pending" -a -z "$GNOME_GIT_IMPORT" ] ; then
+ cat <<EOF 1>&2
+$projectshort is still in the process of being imported. To import
+into $projectshort use 'git push --exec=import'. If you are done
+importing, do:
+
+ ssh USERNAME git gnome org finish-import $projectshort
+EOF
+ exit 1
+fi
+
+if [ \! -e "$GIT_DIR/pending" -a -n "$GNOME_GIT_IMPORT" ] ; then
+ cat <<EOF 1>&2
+$projectshort is no longer in the process of being imported. You
+can push to $projectshort normally. If you accidentally ran
+finish-import too early, please contact gitmaster gnome org
+for assistance.
+EOF
+ exit 1
+fi
+
while read oldrev newrev refname; do
# Unlike the gnome-post-receive script, where we play fancy games
# with 'tee', we invoke the different pre-receive hooks separately
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]