github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/tools/image-tag (about) 1 #!/usr/bin/env bash 2 3 set -o errexit 4 set -o nounset 5 set -o pipefail 6 7 WORKING_SUFFIX=$(if git status --porcelain | grep -qE '^(?:[^?][^ ]|[^ ][^?])\s'; then echo "-WIP"; else echo ""; fi) 8 BRANCH_PREFIX=$(git rev-parse --abbrev-ref HEAD) 9 10 # Fix the object name prefix length to 8 characters to have it consistent across the system. 11 # See https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt---shortlength 12 echo "${BRANCH_PREFIX//\//-}-$(git rev-parse --short=8 HEAD)$WORKING_SUFFIX"