sctp: fix the error code when ASCONF is received with invalid address
[safe/jmp/linux-2.6] / scripts / setlocalversion
index 83b7512..32c8554 100755 (executable)
@@ -9,12 +9,18 @@ usage() {
 cd "${1:-.}" || usage
 
 # Check for git and a git repo.
-if head=`git rev-parse --verify 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
-               if tag=`git describe 2>/dev/null`; then
-                       echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
-               fi
+if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+       # Do we have an untagged tag?
+       if atag=`git describe 2>/dev/null`; then
+               echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+       # add -g${head}, if there is no usable tag
+       else
+               printf '%s%s' -g $head
+       fi
+
+       # Is this git on svn?
+       if git config --get svn-remote.svn.url >/dev/null; then
+               printf -- '-svn%s' "`git svn find-rev $head`"
        fi
 
        # Are there uncommitted changes?
@@ -49,16 +55,9 @@ if hgid=`hg id 2>/dev/null`; then
 fi
 
 # Check for svn and a svn repo.
-if rev=`svn info 2>/dev/null | grep '^Revision'`; then
+if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
        rev=`echo $rev | awk '{print $NF}'`
-       changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
-
-       # Are there uncommitted changes?
-       if [ $changes != 0 ]; then
-               printf -- '-svn%s%s%s' "$rev" -dirty "$changes"
-       else
-               printf -- '-svn%s' "$rev"
-       fi
+       printf -- '-svn%s' "$rev"
 
        # All done with svn
        exit