Files
weave-scope/tools/image-tag
2019-10-02 14:34:20 +00:00

13 lines
497 B
Bash
Executable File

#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
WORKING_SUFFIX=$(if git status --porcelain | grep -qE '^(?:[^?][^ ]|[^ ][^?])\s'; then echo "-WIP"; else echo ""; fi)
BRANCH_PREFIX=$(git rev-parse --abbrev-ref HEAD)
# Fix the object name prefix length to 8 characters to have it consistent across the system.
# See https://git-scm.com/docs/git-rev-parse#Documentation/git-rev-parse.txt---shortlength
echo "${BRANCH_PREFIX//\//-}-$(git rev-parse --short=8 HEAD)$WORKING_SUFFIX"