3 # determine-version -- report a useful version for releases
5 # Copyright 2008, Aron Griffis <agriffis@n01se.net>
6 # Copyright 2008, Oracle
7 # Released under the GNU GPLv2
11 which git
&> /dev
/null
13 git branch
>& /dev
/null
15 if head=`git rev-parse --verify HEAD 2>/dev/null`; then
16 if tag
=`git describe --tags 2>/dev/null`; then
20 # Are there uncommitted changes?
21 git update-index
--refresh --unmerged > /dev
/null
22 if git diff-index
--name-only HEAD | \
23 grep -v "^scripts/package" \
31 echo "#ifndef __BUILD_VERSION" > .build-version.h
32 echo "#define __BUILD_VERSION" >> .build-version.h
33 echo "#define BTRFS_BUILD_VERSION \"Btrfs $v\"" >> .build-version.h
34 echo "#endif" >> .build-version.h
36 diff -q version.h .build-version.h
>& /dev
/null
43 mv .build-version.h version.h