Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
Added tracked hooks to test-assets repo
Browse files Browse the repository at this point in the history
Change-Id: Ic9fda9c5d4b256be01bdb85792de21ef58cbd684
  • Loading branch information
AB Srinivasan committed Oct 5, 2011
1 parent d340433 commit d0a761b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 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
28 changes: 28 additions & 0 deletions 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
11 changes: 11 additions & 0 deletions 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 d0a761b

Please sign in to comment.