Skip to content

Commit 8076a3b

Browse files
committed
version.sh: include revision count when working off master
1 parent ba41c98 commit 8076a3b

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

‎.version.sh‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@ if ( echo "$codeversion" | grep -q "$gitversion" ); then
88
git describe --tags --always --dirty=+ | sed 's/-/+/; s/^v//'
99
else
1010
# working off master, use branch name and rev count
11-
branch=`git symbolic-ref HEAD | sed -n 's:^refs/heads/::p'` || true
11+
branch=`git symbolic-ref HEAD 2>/dev/null | sed -n 's:^refs/heads/::p'` || true
12+
[ -z "$branch" ] || branch="-$branch"
1213
sha=`git rev-parse --short HEAD`
14+
revcount=`git rev-list HEAD | wc -l`
1315
dirty=
1416
if [ -n "`git status --porcelain --untracked=no`" ]; then
1517
dirty="+"
1618
fi
17-
if [ -n "$branch" ]; then
18-
echo "${codeversion}-${branch}-g${sha}${dirty}"
19-
else
20-
echo "${codeversion}-g${sha}${dirty}"
21-
fi
19+
echo "${codeversion}${branch}-${revcount}-g${sha}${dirty}"
2220
fi

0 commit comments

Comments
 (0)