mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Franck Bui-Huu <fbuihuu@gmail.com>
To: mmarek@suse.cz
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix detectition of kernel git repository in setlocalversion script [take #2]
Date: Mon,  2 Dec 2013 16:34:29 +0100	[thread overview]
Message-ID: <1385998469-21515-1-git-send-email-fbuihuu@gmail.com> (raw)
In-Reply-To: <529CA5DE.7030505@gmail.com>

setlocalversion script was testing the presence of .git directory in order to find out
if git is used as SCM to track the current kernel project. However in some cases, .git
is not a directory but can be a file: when the kernel is a git submodule part of a git
super project for example.

This patch just fixes this by using 'git rev-parse --show-cdup' to check that the
current directory is the kernel git topdir. This has the advantage to not test and rely
on git internal infrastructure directly.

Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.com>
---
 scripts/setlocalversion | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 0b5ccf3..3d8af0e 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -43,7 +43,8 @@ scm_version()
 	fi
 
 	# Check for git and a git repo.
-	if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+	if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
+	   head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
 
 		# 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.
-- 
1.8.4.2


  reply	other threads:[~2013-12-02 15:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 13:21 [PATCH] Fix detectition of kernel git repository in setlocalversion script Franck Bui-Huu
2013-12-02 14:57 ` Michal Marek
2013-12-02 15:14   ` Franck Bui-Huu
2013-12-02 15:16     ` Michal Marek
2013-12-02 15:23       ` Franck Bui-Huu
2013-12-02 15:34         ` Franck Bui-Huu [this message]
2014-01-03 13:49           ` [PATCH] Fix detectition of kernel git repository in setlocalversion script [take #2] Michal Marek

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=1385998469-21515-1-git-send-email-fbuihuu@gmail.com \
    --to=fbuihuu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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®