Skip to content

Commit 3fea877

Browse files
authored
Merge pull request #211 from xiulipan/shfix
scripts: version: fix version error when have no tags
2 parents f4716b1 + 0e620cd commit 3fea877

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

version.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/bin/bash
12

23
# version for configure, make dist and FW etc
34
# usage "version.sh dir"
@@ -11,7 +12,13 @@ else
1112
fi
1213

1314
# get version from git tag
14-
GIT_TAG=`git describe --abbrev=4`
15+
GIT_TAG=`git describe --abbrev=4 2>/dev/null`
16+
17+
# may fail to get git describe in some case, add this fallback to handle error
18+
if [[ "x$GIT_TAG" == "x" ]]
19+
then
20+
GIT_TAG="v0.0-0-g0000"
21+
fi
1522

1623
# Some releases have a SOF_FW_XXX_ prefix on the tag and this prefix
1724
# must be stripped for usage in version.h. i.e. we just need the number.

0 commit comments

Comments
 (0)