summaryrefslogtreecommitdiffstats
path: root/scripts/setlocalversion
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/setlocalversion')
-rwxr-xr-xscripts/setlocalversion15
1 files changed, 7 insertions, 8 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index f1c4b35..32c8554 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -10,18 +10,17 @@ cd "${1:-.}" || usage
# Check for git and a git repo.
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
- # Do we have an untagged version?
- if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
- if tag=`git describe 2>/dev/null`; then
- echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
- else
- printf '%s%s' -g $head
- fi
+ # Do we have an untagged tag?
+ if atag=`git describe 2>/dev/null`; then
+ echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+ # add -g${head}, if there is no usable tag
+ else
+ printf '%s%s' -g $head
fi
# Is this git on svn?
if git config --get svn-remote.svn.url >/dev/null; then
- printf -- '-svn%s' "`git-svn find-rev $head`"
+ printf -- '-svn%s' "`git svn find-rev $head`"
fi
# Are there uncommitted changes?
OpenPOWER on IntegriCloud