jjb: babeltrace: check for untracked or modified files in the git repo
authorSimon Marchi <simon.marchi@polymtl.ca>
Tue, 10 Sep 2024 17:46:59 +0000 (13:46 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 3 Oct 2024 14:55:59 +0000 (10:55 -0400)
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 <simon.marchi@polymtl.ca>
scripts/babeltrace/build.sh

index feea2f490a7337bad107ebaaff18e7f06211eb64..7b7318e7cbb7fdee65f7a2c5cd13aa8395d6080c 100755 (executable)
@@ -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"
This page took 0.024014 seconds and 4 git commands to generate.