Import image-tag script into build tools so it can be shared

We have divergent versions of this script across repos.
This particular version comes from 6334836@scope.
We in particular want this version's changes to support branches
with a '/' character in them.
This commit is contained in:
Mike Lang
2016-08-12 14:30:39 +01:00
parent 7e850f87df
commit 5312c40075

12
image-tag Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
WORKING_SUFFIX=$(if ! git diff --exit-code --quiet HEAD >&2; \
then echo "-WIP"; \
else echo ""; \
fi)
BRANCH_PREFIX=$(git rev-parse --abbrev-ref HEAD)
echo "${BRANCH_PREFIX//\//-}-$(git rev-parse --short HEAD)$WORKING_SUFFIX"