| # determine-version -- report a useful version for releases |
| # Copyright 2008, Aron Griffis <agriffis@n01se.net> |
| # Released under the GNU GPLv2 |
| if head=`git rev-parse --verify HEAD 2>/dev/null`; then |
| if tag=`git describe --tags 2>/dev/null`; then |
| # Are there uncommitted changes? |
| git update-index --refresh --unmerged > /dev/null |
| if git diff-index --name-only HEAD | \ |
| grep -v "^scripts/package" \ |
| echo "#ifndef __BUILD_VERSION" > .build-version.h |
| echo "#define __BUILD_VERSION" >> .build-version.h |
| echo "#define BTRFS_BUILD_VERSION \"Btrfs $v\"" >> .build-version.h |
| echo "#endif" >> .build-version.h |
| diff -q version.h .build-version.h >& /dev/null |
| mv .build-version.h version.h |