Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions install_hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ echo ""
echo "Git pre-commit hook installation."
echo ""
if [ $# = 1 ] ; then
if [ -d "$1/.git" ] ; then
if [ -e "$1/.git" ] ; then
if [ -d "$1/.git" ] ; then
GIT_FOLDER=$1/.git
else
GIT_FOLDER=$1/`cat $1/.git | awk '{ print ($2) }'`
fi
# create hooks subfolder if it does not yet exist
mkdir -p -- "$1/.git/hooks"
mkdir -p -- "$GIT_FOLDER/hooks"

echo "Copying prerequisites."
cp -i -- "$SCRIPTPATH/canonicalize_filename.sh" "$1/.git/hooks/" || true
cp -i -- "$SCRIPTPATH/canonicalize_filename.sh" "$GIT_FOLDER/hooks/" || true
echo ""
copy_hooks "$1/.git"
copy_hooks "$GIT_FOLDER"
echo ""
echo "Finished installation."
else
Expand Down