From dcd51470d402ffe875984aa33513590031bc94a7 Mon Sep 17 00:00:00 2001 From: Stephen Haberman Date: Sun, 22 Jun 2008 15:14:17 -0500 Subject: [PATCH] Dumb shell script installer for our client hooks. --- install-cbas-client-hooks.sh | 33 +++++++++++++++++++++++++++++++++ make-cbas-client-hooks.sh | 17 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 install-cbas-client-hooks.sh create mode 100644 make-cbas-client-hooks.sh diff --git a/install-cbas-client-hooks.sh b/install-cbas-client-hooks.sh new file mode 100644 index 0000000..5f81087 --- /dev/null +++ b/install-cbas-client-hooks.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +rm .git/hooks/* + +cat >.git/hooks/commit-msg <<'FOO' +#!/bin/sh + +grep -i '\(\(re\|refs\|qa\) #[0-9]\+\)\|\(no ticket\)' "$1" > /dev/null + +if [ $? -ne 0 ] +then + echo "Please reference a ticket" + exit 1 +fi +FOO + +cat >.git/hooks/post-checkout <<'FOO' +#!/bin/bash + +# The hook is given three parameters: the ref of the previous HEAD, the ref of +# the new HEAD (which may or may not have changed), and a flag indicating +# whether the checkout was a branch checkout (changing branches, flag=1) or a +# file checkout (retrieving a file from the index, flag=0). + +branch=$(git symbolic-ref HEAD) +branch=${branch/refs\/heads\//} + +git config --list | grep "branch.${branch}.rebase" > /dev/null +if [ $? -ne 0 ] ; then + git config --add "branch.${branch}.rebase" true +fi +FOO + diff --git a/make-cbas-client-hooks.sh b/make-cbas-client-hooks.sh new file mode 100644 index 0000000..573791f --- /dev/null +++ b/make-cbas-client-hooks.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +cat >install-cbas-client-hooks.sh <.git/hooks/commit-msg <<'FOO' +$(cat client/commit-msg-trac) +FOO + +cat >.git/hooks/post-checkout <<'FOO' +$(cat client/post-checkout-rebase) +FOO + +EOF + -- 2.39.5