From: Simon Marchi Date: Tue, 10 Sep 2024 17:46:59 +0000 (-0400) Subject: jjb: babeltrace: check for untracked or modified files in the git repo X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6ea95b0dd5eca0d5e72d100e0a39975e3aec382b;p=lttng-ci.git jjb: babeltrace: check for untracked or modified files in the git repo To help spot missing entries in .gitignore, or build steps that somehow modify source files, do a `git status` in the git repo after builds. Fail the build if there are untracked or modified files. Change-Id: Id93da324d234e30979418f8f77d29e98f24677c8 Signed-off-by: Simon Marchi --- diff --git a/scripts/babeltrace/build.sh b/scripts/babeltrace/build.sh index feea2f4..7b7318e 100755 --- a/scripts/babeltrace/build.sh +++ b/scripts/babeltrace/build.sh @@ -468,6 +468,21 @@ if [ "$BABELTRACE_RUN_TESTS" = "yes" ]; then rsync -a --include 'test-suite.log' --include '*/' --exclude='*' tests/ "$WORKSPACE/log" fi +# Check that the git repository has no untracked files, meaning that +# .gitignore is not missing anything. +pushd "$SRCDIR" + +git_status_output=$(git status --short) +if [ -n "$git_status_output" ]; then + echo "Error: There are untracked or modified files in the repository:" + echo "git_status_output" + exit_status=1 +else + echo "No untracked or modified files." +fi + +popd + # Clean the build directory if [ "$BABELTRACE_MAKE_CLEAN" = "yes" ]; then print_header "Clean"