File indexing completed on 2024-05-12 04:44:28

0001 #!/bin/bash -fxv
0002 # NOTE #!/bin/bash -fxv prints all executed commands.
0003 
0004 # SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
0005 # SPDX-License-Identifier: BSD-2-Clause OR MIT
0006 
0007 
0008 
0009 
0010 
0011 # -e exits on error,
0012 # -u errors on undefined variables,
0013 # and -o (for option) pipefail exits on command pipe failures
0014 set -euo pipefail
0015 errorcount=0
0016 
0017 # The “.” command will execute the given script within the context of
0018 # the current script, which is necessary in order to preserve the
0019 # environment variables that are set by the given script.
0020 . scripts/export-environment.sh
0021 rm --recursive --force build
0022 scripts/format.sh
0023 git diff > artifact_format_diff.txt
0024 git reset --hard HEAD
0025 [ -s artifact_format_diff.txt ] && ((errorcount++))
0026 
0027 echo Terminating ci-format.sh with exit code $errorcount.
0028 # NOTE The exit code of the last command is available with $? in the shell.
0029 exit $errorcount