diff options
Diffstat (limited to 'scripts/setlocalversion')
-rwxr-xr-x | scripts/setlocalversion | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index f1c4b35bc324..32c8554f3946 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -10,18 +10,17 @@ cd "${1:-.}" || usage | |||
10 | 10 | ||
11 | # Check for git and a git repo. | 11 | # Check for git and a git repo. |
12 | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then | 12 | if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then |
13 | # Do we have an untagged version? | 13 | # Do we have an untagged tag? |
14 | if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then | 14 | if atag=`git describe 2>/dev/null`; then |
15 | if tag=`git describe 2>/dev/null`; then | 15 | echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' |
16 | echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' | 16 | # add -g${head}, if there is no usable tag |
17 | else | 17 | else |
18 | printf '%s%s' -g $head | 18 | printf '%s%s' -g $head |
19 | fi | ||
20 | fi | 19 | fi |
21 | 20 | ||
22 | # Is this git on svn? | 21 | # Is this git on svn? |
23 | if git config --get svn-remote.svn.url >/dev/null; then | 22 | if git config --get svn-remote.svn.url >/dev/null; then |
24 | printf -- '-svn%s' "`git-svn find-rev $head`" | 23 | printf -- '-svn%s' "`git svn find-rev $head`" |
25 | fi | 24 | fi |
26 | 25 | ||
27 | # Are there uncommitted changes? | 26 | # Are there uncommitted changes? |