mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nico Schottelius <nico-linux-20090330@schottelius.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: trivial@kernel.org
Subject: [PATCH] Fix scripts/setlocalversion with git
Date: Mon, 30 Mar 2009 14:21:37 +0200	[thread overview]
Message-ID: <20090330122137.GA6918@denkbrett.schottelius.org> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 549 bytes --]

Hello!

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.

Please apply, otherwise testers like me always have '2.6.29' for trees
with unanottated tags, instead of 2.6.29-20318-g9aa4755, which helps
a lot if you've tons of kernels installed from different trees.

Sincerly,

Nico

ps: please cc on reply

[-- Attachment #1.2: patch-localversion-2.6.29 --]
[-- Type: text/plain, Size: 809 bytes --]

--- old/scripts/setlocalversion	2009-03-27 09:37:07.160938681 +0100
+++ new/scripts/setlocalversion	2009-03-30 14:14:21.187397016 +0200
@@ -10,13 +10,12 @@
 
 # Check for git and a git repo.
 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
-		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
+	# Do we have an annotated 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?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

             reply	other threads:[~2009-03-30 12:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-30 12:21 Nico Schottelius [this message]
2009-04-07 15:44 ` [Resend] " Nico Schottelius
2009-04-07 15:56   ` Jiri Kosina
2009-04-07 17:45     ` Sam Ravnborg
2009-04-17 21:34       ` Nico Schottelius
2009-04-17 21:58         ` Sam Ravnborg
2009-04-18  9:16           ` Nico Schottelius
2009-04-25  7:50             ` Sam Ravnborg
2009-04-25 12:24               ` Nico Schottelius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090330122137.GA6918@denkbrett.schottelius.org \
    --to=nico-linux-20090330@schottelius.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®