mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-02 03:08:53 +00:00
Move git-hooks out of newznab into build folder, update hooks, remove addGitHook.php, not used anymore (ported from nZEDb @niel)
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/sh
|
||||
#version=10
|
||||
#
|
||||
# The hook should
|
||||
# exit with non-zero status after issuing an appropriate message if
|
||||
# it wants to stop the commit.
|
||||
#
|
||||
# To enable this hook, rename this file to "pre-commit".
|
||||
|
||||
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
|
||||
|
||||
#####################################################################################################
|
||||
|
||||
EXIT_STATUS=0
|
||||
|
||||
NNTMUX=`pwd`
|
||||
HOOK_DIR=/build/git-hooks
|
||||
GIT=/.git/hooks
|
||||
PC=/pre-commit
|
||||
|
||||
# Strip off the current directory path if we are run from in the git-hooks directory.
|
||||
PROJECT=${NNTMUX%${HOOK_DIR}}
|
||||
HOOKS=${PROJECT}${HOOK_DIR}
|
||||
FILE_LIST=${HOOKS}/git_hook_list.txt
|
||||
|
||||
if [ -e ${FILE_LIST} ]
|
||||
then
|
||||
rm ${FILE_LIST}
|
||||
fi
|
||||
touch ${FILE_LIST}
|
||||
|
||||
for FILE in `git diff-index --cached --name-only --diff-filter=AM ${AGAINST}`
|
||||
do
|
||||
echo ${PROJECT}/${FILE} >> ${FILE_LIST}
|
||||
done
|
||||
|
||||
/usr/bin/php ${HOOKS}/runHooks.php
|
||||
|
||||
EXIT_STATUS=$?
|
||||
|
||||
if [ -e ${FILE_LIST} ]
|
||||
then
|
||||
rm ${FILE_LIST}
|
||||
fi
|
||||
|
||||
if [ ${EXIT_STATUS} -gt 0 ]
|
||||
then
|
||||
exit ${EXIT_STATUS}
|
||||
fi
|
||||
|
||||
# If there are whitespace errors, print the offending file names and fail.
|
||||
exec git diff-index --check --cached ${AGAINST} --
|
||||
Reference in New Issue
Block a user