aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/setlocalversion
diff options
context:
space:
mode:
authorNico Schottelius <nico-linux-20090330@schottelius.org>2009-04-25 03:48:39 -0400
committerSam Ravnborg <sam@ravnborg.org>2009-05-01 04:54:04 -0400
commita182ad3d0f858f50bb719a48bb35a013e12366c5 (patch)
treeac68356f710cf5be77d6e6d529d49f598aaf67ea /scripts/setlocalversion
parent99e3a1eb3c22bb671c6f3d22d8244bfc9fad8185 (diff)
kbuild: fix scripts/setlocalversion with git
When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion. This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev. Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/setlocalversion')
-rwxr-xr-xscripts/setlocalversion13
1 files changed, 6 insertions, 7 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 47e75b69a2e9..32c8554f3946 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -10,13 +10,12 @@ cd "${1:-.}" || usage
10 10
11# Check for git and a git repo. 11# Check for git and a git repo.
12if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then 12if 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?