Skip to content

Commit

Permalink
Clean up git-version script.
Browse files Browse the repository at this point in the history
- bash doesn't always exist in /bin
- Use $() instead of backticks
- Wrap string in double-quotes to prevent globbing/splitting. (see https://github.com/koalaman/shellcheck/wiki/SC2086)
  • Loading branch information
ggreer committed May 1, 2017
1 parent 662d370 commit e20541a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions git-version
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash -e
#!/usr/bin/env bash

set -e

# pull the current git commit hash
COMMIT=`git rev-parse HEAD`
COMMIT=$(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)
Expand All @@ -18,4 +20,4 @@ if [ -n "$(git diff --shortstat 2> /dev/null | tail -n1)" ]; then
VERSION="${VERSION}_dirty"
fi

echo $VERSION
echo "$VERSION"

0 comments on commit e20541a

Please sign in to comment.