network/tests/git-post-commit.sh
Rich Megginson 428273cf2a refactor: get_ostree_data.sh use env shebang - remove from .sanity*
Use the `#!/usr/bin/env bash` shebang which is ansible-test friendly.
This means we can remove get_ostree_data.sh from the .sanity* files.
This also means we can remove the .sanity* files if we do not need
them otherwise.  Fix other shell scripts to use the friendly shebang
and remove from the .sanity* files.

Rename `pth` to `path` in honor of nscott

Signed-off-by: Rich Megginson <rmeggins@redhat.com>
2023-12-07 07:25:47 -07:00

22 lines
690 B
Bash
Executable file

#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
set -euo pipefail
# Run script ensure_provider_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/post-commit
# 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"
python ./ensure_provider_tests.py generate
cd "$GITPATH"
git add tests/tests_*_nm.yml tests/tests_*_initscripts.yml
git commit --amend -C HEAD --no-verify
fi