We have to go through some pretty scary gyrations to extract this information from git, but it can be done. This works with both tarballs generated by 'git archive', or with your local git repo. (Requested by 'David' on the mailing list.)
40 lines
729 B
Text
40 lines
729 B
Text
redo-ifchange gitvars prodname
|
|
|
|
read PROD <prodname
|
|
|
|
exec <gitvars
|
|
read COMMIT
|
|
read NAMES
|
|
read DATE
|
|
|
|
# the list of names is of the form:
|
|
# (x,y,tag: $PROD-####,tag: $PROD-####,a,b)
|
|
# The entries we want are the ones starting with "tag: $PROD-" since those
|
|
# refer to the right actual git tags.
|
|
names_to_tag()
|
|
{
|
|
x=${1#\(}
|
|
x=${x%\)}
|
|
cur=
|
|
while [ "$cur" != "$x" ]; do
|
|
cur=${x%%,*}
|
|
cur=${cur#tag: }
|
|
cur=${cur## }
|
|
tagpost=${cur#$PROD-}
|
|
if [ "$cur" != "$tagpost" ]; then
|
|
echo "$tagpost"
|
|
return 0
|
|
fi
|
|
x=${x#*,}
|
|
done
|
|
commitpost=${COMMIT#???????}
|
|
commitpre=${COMMIT%$commitpost}
|
|
echo "unknown-$commitpre"
|
|
}
|
|
|
|
|
|
sTAG=$(names_to_tag "$NAMES")
|
|
|
|
echo "COMMIT='$COMMIT'"
|
|
echo "TAG='$sTAG'"
|
|
echo "DATE='${DATE%% *}'"
|