Skip to content
Browse files

Added tracked hooks to vcap repo

Change-Id: Icab6ff74d16677ec269d6bf6a5cb5d842069d770
  • Loading branch information...
1 parent db6cdc5 commit fcba60775bf370576fd46162b068a4fd44a1ff66 Vadim Spivak committed
Showing with 48 additions and 0 deletions.
  1. +9 −0 git/hooks-wrapper
  2. +28 −0 git/install-hook-symlinks
  3. +11 −0 git/tracked_hooks/pre-commit
View
9 git/hooks-wrapper
@@ -0,0 +1,9 @@
+#!/bin/bash
+if [ -x $0.local ]; then
+ $0.local "$@" || exit $?
+fi
+
+REPO_DIR=$(dirname $GIT_DIR)
+if [ -x $REPO_DIR/git/tracked_hooks/$(basename $0) ]; then
+ $REPO_DIR/git/tracked_hooks/$(basename $0) "$@" || exit $?
+fi
View
28 git/install-hook-symlinks
@@ -0,0 +1,28 @@
+#!/bin/bash
+HOOK_NAMES="
+applypatch-msg
+pre-applypatch
+post-applypatch
+pre-commit
+prepare-commit-msg
+commit-msg
+post-commit
+pre-rebase
+post-checkout
+post-merge
+pre-receive
+update
+post-receive
+post-update
+pre-auto-gc
+"
+
+HOOK_SRC=$(dirname $0)
+HOOK_DIR=$(git rev-parse --git-dir)/hooks || exit $?
+
+for hook in $HOOK_NAMES; do
+ if [ ! -h $HOOK_DIR/$hook -a -x $HOOK_DIR/$hook ]; then
+ mv $HOOK_DIR/$hook $HOOK_DIR/$hook.local
+ fi
+ ln -s -f ../../git/hooks-wrapper $HOOK_DIR/$hook
+done
View
11 git/tracked_hooks/pre-commit
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if git rev-parse --verify HEAD >/dev/null 2>&1
+then
+ against=HEAD
+else
+ # Initial commit: diff against an empty tree object
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+exec git diff-index --check --cached $against --

0 comments on commit fcba607

Please sign in to comment.
Something went wrong with that request. Please try again.