mirror of
https://github.com/lingble/tegra-demo-distro.git
synced 2025-11-02 05:28:10 +00:00
scripts-setup: Add example pre commit hook
To support the upcoming OE4T contributor guide wiki page, add a script which generates a pre-commit hook with Signed-off-by message appended. Signed-off-by: Dan Walkes <danwalkes@boulderai.com>
This commit is contained in:
18
scripts-setup/setup-git-hooks
Executable file
18
scripts-setup/setup-git-hooks
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
BASEDIR=$(git rev-parse --show-toplevel)
|
||||
SCRIPTDIR=$(dirname $0)
|
||||
for GITHOOKDIR in ${BASEDIR}/.git/hooks ${BASEDIR}/.git/modules/repos/*/hooks
|
||||
do
|
||||
for GITHOOK in ${SCRIPTDIR}/git-scripts/*
|
||||
do
|
||||
GITHOOKFILE=$(basename $GITHOOK)
|
||||
if [ -e ${GITHOOKDIR}/${GITHOOKFILE} ]; then
|
||||
echo "A git hook file aleady exists at ${GITHOOKDIR}/${GITHOOKFILE}, leaving as-is"
|
||||
else
|
||||
echo "Adding ${GITHOOKFILE} to ${GITHOOKDIR}"
|
||||
cp ${GITHOOK} ${GITHOOKDIR}
|
||||
chmod a+x ${GITHOOKDIR}/${GITHOOKFILE}
|
||||
fi
|
||||
done
|
||||
done
|
||||
Reference in New Issue
Block a user