#!/bin/sh
|
|
# Check for git and a git repo.
|
git_version() {
|
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
|
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
|
# it, because this version is defined in the top level Makefile.
|
if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
|
|
# If we are past a tagged commit (like
|
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
|
if atag="`git describe 2>/dev/null`"; then
|
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
|
# If we don't have a tag at all we print -g{commitish}.
|
else
|
printf '%s' $head
|
fi
|
|
# Check for uncommitted changes
|
if git diff-index --name-only HEAD | grep -qv "^scripts/"; then
|
printf '%s' -dirty
|
fi
|
fi
|
|
fi
|
# All done with git
|
return
|
}
|
|
git_version;
|