[lkml]   [2012]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH v2] kbuild: setlocalversion: ignore private tags while reporting local version
The output of 'git describe' is relative to the immediate preceding tag.
When the immediate tag preceding or at the HEAD is a private tag,
setlocalversion extracts information with respect to the private tag and
wrongly reports them with respect to Linux tag.

Fixing this to extract information with respect to Linux tags.

CC: Michal Marek <>
Signed-off-by: Tushar Behera <>
Changes since v1:
* Extend the fix when the HEAD is a private tagged commit

scripts/setlocalversion | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index bd6dca8..b65e8a9 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -47,7 +47,7 @@ scm_version()

# 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 [ -z "`git describe --exact-match --match v[2-9].* 2>/dev/null`" ]; then

# If only the short version is requested, don't bother
# running further git commands
@@ -57,7 +57,8 @@ scm_version()
# 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
+ # Also match linux tags pattern to discard private tags
+ if atag="`git describe --match v[2-9].* 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}.

 \ /
  Last update: 2012-09-12 12:21    [W:0.046 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site