X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fsetlocalversion;h=72d233528ade5dfb5a98c022795c12c55aae7bbc;hb=a684e7d33096892093456dd56a582cfc3bfad648;hp=1c1bdaf7348a61fc3606165cb1cc5c6725831e05;hpb=b5eb9513f7c1bee862ada22bf1489f53752686bd;p=linux-2.6-omap-h63xx.git diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 1c1bdaf7348..72d233528ad 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -9,10 +9,14 @@ usage() { cd "${1:-.}" || usage # Check for git and a git repo. -if head=`git rev-parse --verify HEAD 2>/dev/null`; then +if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then # Do we have an untagged version? if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then - git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' + if tag=`git describe 2>/dev/null`; then + echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' + else + printf '%s%s' -g $head + fi fi # Are there uncommitted changes? @@ -53,7 +57,7 @@ if rev=`svn info 2>/dev/null | grep '^Revision'`; then # Are there uncommitted changes? if [ $changes != 0 ]; then - printf -- '-svn%s%s%s' "$rev" -dirty "$changes" + printf -- '-svn%s%s' "$rev" -dirty else printf -- '-svn%s' "$rev" fi