From 6ea95b0dd5eca0d5e72d100e0a39975e3aec382b Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 10 Sep 2024 13:46:59 -0400 Subject: [PATCH] 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 --- scripts/babeltrace/build.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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" -- 2.34.1