Support alternate separators for gitversion

This commit is contained in:
2013-06-15 12:08:20 -03:00
parent f725a96eaa
commit d750526dc7

View File

@@ -1,10 +1,11 @@
#!/bin/bash #!/bin/bash
LOGSPEC='%ci %an <%aE>%n%n %s%n [%h]%d%n' LOGSPEC='%ci %an <%aE>%n%n %s%n [%h]%d%n'
VERSIONERS_SEPARATOR=${VERSIONERS_SEPARATOR:-,}
BRANCH=$2 BRANCH=$2
if [ "${BRANCH}" == "" ]; then if [ "${BRANCH}" == "" ]; then
BRANCH=$(git branch | grep '^\*\s*.*' | cut -d ' ' -f 2) BRANCH=$(git branch | grep '^\*\s*.*' | cut -d ' ' -f 2-)
fi fi
REBUILDING=0 REBUILDING=0
@@ -18,8 +19,8 @@ if [ "$TAG" == "" ]; then
REBUILDING=1 REBUILDING=1
MAJOR=$BRANCH MAJOR=$BRANCH
else else
MAJOR=$(echo $TAG | cut -d , -f 2) MAJOR=$(echo $TAG | cut -d ${VERSIONERS_SEPARATOR} -f 2)
BUILD=$(echo $TAG | cut -d , -f 3) BUILD=$(echo $TAG | cut -d ${VERSIONERS_SEPARATOR} -f 3)
if [ "$TAGSHA" != "$SHA1" ]; then if [ "$TAGSHA" != "$SHA1" ]; then
CHANGELOG="$(git log --format="format:$LOGSPEC" $TAGSHA..$SHA1)" CHANGELOG="$(git log --format="format:$LOGSPEC" $TAGSHA..$SHA1)"
BUILD=$(expr $BUILD + 1) BUILD=$(expr $BUILD + 1)