1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#!/bin/bash
if [ ! -z "$EMC2_HOME" ]; then
source $EMC2_HOME/scripts/githelper.sh
else
source $(git rev-parse --show-toplevel)/scripts/githelper.sh
fi
githelper $1
if [ "$DEB_COMPONENT" = "scratch" ]; then
DESCRIBE=$(git describe --tags --exact-match 2>/dev/null)
if [ -n "$DESCRIBE" ]; then
echo "$DESCRIBE"
else
DESCRIBE=$(git describe --tags 2>/dev/null)
if [ -n "$DESCRIBE" ]; then
echo "$DESCRIBE"
else
BR=$(printf '%s' "$GIT_BRANCH" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^-.+:~a-z0-9]/-/g; s/-{2,}/-/g; s/^-//; s/-$//')
echo "v$(git show HEAD:VERSION | cut -d ' ' -f 1)~${BR:-head}~$(git show --pretty=format:%h HEAD | head -1)"
fi
fi
else
# known branches get the "describe" of the most recent signed git tag,
# or of the most recent unsigned tag if no signed tags are found
git describe --match "$GIT_TAG"
fi
|