summaryrefslogtreecommitdiff
path: root/scripts/git-version
diff options
context:
space:
mode:
authorBunnaroath Sou <bsou@sifive.com>2019-03-22 11:21:43 -0700
committerBunnaroath Sou <bsou@sifive.com>2019-03-22 11:21:43 -0700
commit8c4777c677ef24d6c89c8d116863faa4654d3529 (patch)
tree8ef6c681e5c3675e5ee5260dce4b8da693f6495b /scripts/git-version
parentaeb8cfb4769080b1b3ce5cf0af8be67a9087ece7 (diff)
Initial internal tag 0.0.1 for FS 19.03 RC
Diffstat (limited to 'scripts/git-version')
-rwxr-xr-xscripts/git-version21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/git-version b/scripts/git-version
new file mode 100755
index 0000000..850c19b
--- /dev/null
+++ b/scripts/git-version
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+version='v0.0.1'
+
+if test -d .git
+then
+ gv=`git describe`
+ if [[ "$?" == "0" ]]
+ then
+ if [[ "$(echo "${gv}" | cut -d'-' -f1)" != "$version" ]]
+ then
+ echo "$0 has mismatched version" >&2
+ echo "${gv}-ERROR"
+ exit 1
+ fi
+
+ version="$(echo ${gv} | cut -c2-)"
+ fi
+fi
+
+echo "${version}"