#!/bin/bash

# Run script generate_tests.py and append test files generated by it to the commit.

# This script is intended to be used as git post-commit hook.
# Make sure file is executable and copy it to <your repo>/.git/hooks/
# This script has to be used together with pre-commit to work properly.

GITPATH=`git rev-parse --show-toplevel`

if [ -e $GITPATH/.commit ]
    then
    rm $GITPATH/.commit

    cd $GITPATH/tests/scripts && /usr/bin/python generate_tests.py

    git add $GITPATH/tests/tests_*_generated.yml
    git commit --amend -C HEAD --no-verify
fi
