# Copyright 2008, Oracle
# Released under the GNU GPLv2
-v="Btrfs v0.15"
+v="v0.20-rc1"
-which hg > /dev/null
-if [ $? == 0 ]; then
+which git &> /dev/null
+if [ $? == 0 -a -d .git ]; then
+ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+ if tag=`git describe --tags 2>/dev/null`; then
+ v="$tag"
+ fi
+
+ # Are there uncommitted changes?
+ git update-index --refresh --unmerged > /dev/null
+ if git diff-index --name-only HEAD | grep -v "^scripts/package" \
+ | read dummy; then
+ v="$v"-dirty
+ fi
+ fi
+fi
+
+which hg &> /dev/null
+if [ $? == 0 -a -d .hg ]; then
last=$(hg tags | grep -m1 -o '^v[0-9.]\+')
# now check if the repo has commits since then...