Skip to content

Commit

Permalink
version.sh: include revision count when working off master
Browse files Browse the repository at this point in the history
  • Loading branch information
aswild committed Jun 29, 2018
1 parent ba41c98 commit 8076a3b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions .version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ if ( echo "$codeversion" | grep -q "$gitversion" ); then
git describe --tags --always --dirty=+ | sed 's/-/+/; s/^v//'
else
# working off master, use branch name and rev count
branch=`git symbolic-ref HEAD | sed -n 's:^refs/heads/::p'` || true
branch=`git symbolic-ref HEAD 2>/dev/null | sed -n 's:^refs/heads/::p'` || true
[ -z "$branch" ] || branch="-$branch"
sha=`git rev-parse --short HEAD`
revcount=`git rev-list HEAD | wc -l`
dirty=
if [ -n "`git status --porcelain --untracked=no`" ]; then
dirty="+"
fi
if [ -n "$branch" ]; then
echo "${codeversion}-${branch}-g${sha}${dirty}"
else
echo "${codeversion}-g${sha}${dirty}"
fi
echo "${codeversion}${branch}-${revcount}-g${sha}${dirty}"
fi

0 comments on commit 8076a3b

Please sign in to comment.