#!/bin/bash

PROJECT_ROOT=$_4DSSE_ROOT
# Check if the project root is set
if [ -z "$PROJECT_ROOT" ]; then
    echo "The 4DSSE root is not set. Please set the _4DSSE_ROOT environment variable."
    exit 1
fi

cp $PROJECT_ROOT/commit-config/hooks/post-commit $PROJECT_ROOT/.git/hooks/post-commit

# Make sure the post-commit hook is executable
chmod +x $PROJECT_ROOT/.git/hooks/post-commit

# Check if the post-commit hook was copied successfully
if [ ! -f $PROJECT_ROOT/.git/hooks/post-commit ]; then
    echo "ERROR! The post-commit hook was not copied successfully."
    exit 1
fi