Files
tegra-demo-distro/scripts-setup/setup-git-hooks
Dan Walkes e6bd1d9aaf 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>
2020-11-17 03:57:07 -08:00

19 lines
593 B
Bash
Executable File

#!/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