Files
graphene/Scripts/gitignore-test
Jörg Thalheim 82caa0683d [Scripts] Make bash shebangs portable
Unlike /usr/bin/env which is a Posix standard, there is no guarentee
that /bin/bash exists. This is the case for operating systems such
as FreeBSD, NixOS and Guix. By using /usr/bin/env we also give
the user the option to provide their own bash in a different path
by setting the $PATH environemnt variable.
Distributions usually provide their own packaging wrappers
to fixup shebangs upon installation, however those are not convienent
to use when developing in the source tree.

See also other upstream discussions about the topic:

- https://github.com/systemd/systemd/pull/5816
2020-06-24 19:51:55 +02:00

23 lines
798 B
Bash
Executable File

#!/usr/bin/env bash
set -eu -o pipefail
# Intended to be run after a build. Returns 1 (i.e. failure) if there's at
# least one modified or untracked file which is not gitignored.
# Don't inline it in the if, since we want to exit on error return codes (set -e).
status="$(git status --porcelain)"
if [ -z "$status" ]; then
echo "No not-gitignored changes :]"
exit 0
fi
echo "================================================================================"
echo " ERROR: Files modified by build, but not gitignored:"
echo "--------------------------------------------------------------------------------"
echo "$status"
git submodule foreach --recursive git status --porcelain
echo "================================================================================"
exit 1