Permalink
Browse files

Merge branch 'master' into mswinmt

  • Loading branch information...
2 parents f5368a6 + 1e9235d commit c7dbac76792dcf51d23ee2f3475660376690fba2 @akovalenko committed Jan 3, 2012
Showing with 79 additions and 5 deletions.
  1. +10 −0 git/README
  2. +11 −0 git/post-receive
  3. +39 −0 git/update
  4. +19 −5 tests/script.test.sh
View
10 git/README
@@ -0,0 +1,10 @@
+SBCL Git Hooks
+
+These scripts live in /home/scm_git/s/sb/sbcl/sbcl.git/hooks on
+SourceForge, and have nothing to do with SBCL as such -- and
+everything to do with developer convenience and maintenance.
+
+To push updates there:
+
+ ssh -t <sfuser>,sbcl@shell.sourceforge.net create
+ scp <script> <sfuser>,sbcl@shell.sourceforge.net:/home/scm_git/s/sb/sbcl/sbcl.git/hooks/
View
11 git/post-receive
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# The "post-receive" script is run after receive-pack has accepted a pack
+# and the repository has been updated. It is passed arguments in through
+# stdin in the form
+# <oldrev> <newrev> <refname>
+# For example:
+# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
+#
+
+hooks/post-receive-email
View
39 git/update
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# --- Command line
+refname="$1"
+oldrev="$2"
+newrev="$3"
+
+# --- Safety check
+if [ -z "$GIT_DIR" ]; then
+ echo "Don't run this script from the command line." >&2
+ echo " (if you want, you could supply GIT_DIR then run" >&2
+ echo " $0 <ref> <oldrev> <newrev>)" >&2
+ exit 1
+fi
+
+if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
+ echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
+ exit 1
+fi
+
+# Don't allow merge commits on master
+if [ "$refname" = "refs/heads/master" ]
+then
+ for rev in $(git rev-list $newrev --not $oldrev)
+ do
+ echo -n "Checking: $rev"
+ if git rev-parse --verify --quiet $rev^2 > /dev/null
+ then
+ echo " (merge!)"
+ echo
+ echo "Merges not allowed on master. Rebase your changes instead."
+ echo
+ exit 1
+ else
+ echo " (ok)"
+ fi
+ done
+fi
+
View
24 tests/script.test.sh
@@ -38,15 +38,29 @@ run_sbcl --script $tmpscript
check_status_maybe_lose "--script exit status from normal exit" $? 0 "(everything ok)"
cat > $tmpscript <<EOF
-#+(or darwin netbsd openbsd)
-(progn
- (format t "silently skipping known failure in script.test.sh~%")
- (sb-ext:quit :unix-status 3))
-(setf *standard-output* (open "/dev/stdout"))
+(setf *standard-output* (make-broadcast-stream))
(close *standard-output*)
(sb-ext:quit :unix-status 3)
EOF
run_sbcl --script $tmpscript >/dev/null
+check_status_maybe_lose "--script exit status from QUIT when standard-output closed" $? 3 "(as given)"
+run_sbcl --load $tmpscript >/dev/null
+check_status_maybe_lose "--load exit status from QUIT when standard-output closed" $? 3 "(as given)"
+
+cat > $tmpscript <<EOF
+(close *standard-output*)
+(sb-ext:quit :unix-status 3)
+EOF
+run_sbcl --script $tmpscript >/dev/null
+check_status_maybe_lose "--script exit status from QUIT when original standard-output closed" $? 3 "(as given)"
+run_sbcl --load $tmpscript >/dev/null
+check_status_maybe_lose "--load exit status from QUIT when original standard-output closed" $? 3 "(as given)"
+
+cat > $tmpscript <<EOF
+(close sb-sys:*stdout*)
+(sb-ext:quit :unix-status 3)
+EOF
+run_sbcl --script $tmpscript >/dev/null
check_status_maybe_lose "--script exit status from QUIT when stdout closed" $? 3 "(as given)"
run_sbcl --load $tmpscript >/dev/null
check_status_maybe_lose "--load exit status from QUIT when stdout closed" $? 3 "(as given)"

0 comments on commit c7dbac7

Please sign in to comment.