Skip to content

Commit

Permalink
git-version: always use commit as part of the version
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-M committed Jun 2, 2017
1 parent ce66542 commit 68c4adb
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions git-version
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
set -e

# pull the current git commit hash
COMMIT=$(git rev-parse HEAD)
VERSION=$(git rev-parse HEAD)

# check if the current commit has a matching tag
TAG=$(git describe --exact-match --abbrev=0 --tags ${COMMIT} 2> /dev/null || true)

# use the matching tag as the version, if available
# check if the current commit has a matching tag,
# and prepend the matching tag to the version, if available.
TAG=$(git describe --exact-match --abbrev=0 --tags ${VERSION} 2> /dev/null || true)
if [ -z "$TAG" ]; then
VERSION=$COMMIT
else
VERSION=$TAG
VERSION=$TAG_$VERSION
fi

# check for changed files (not untracked files)
Expand Down

0 comments on commit 68c4adb

Please sign in to comment.