Skip to content

Commit

Permalink
added: detect dirty trees
Browse files Browse the repository at this point in the history
  • Loading branch information
opdenkamp committed Dec 1, 2015
1 parent 7d210e9 commit 3de451f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion support/git-rev.sh
Expand Up @@ -5,8 +5,13 @@ if git rev-parse --git-dir > /dev/null 2>&1; then
last_tag=`git describe --tags --abbrev=0`
last_hash=`git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h"`
commits_since_tag=`git log ${last_tag}..HEAD --oneline | wc -l`
git_dirty=`git diff HEAD | wc -l`
if [ $commits_since_tag -gt 0 ]; then
echo "${last_tag}+${commits_since_tag}-${last_hash}"
dirty=""
if [ $git_dirty -gt 0 ]; then
dirty="~dirty"
fi
echo "${last_tag}+${commits_since_tag}-${last_hash}${dirty}"
else
echo $last_tag
fi
Expand Down

0 comments on commit 3de451f

Please sign in to comment.