aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/setlocalversion
diff options
context:
space:
mode:
authorFranck Bui-Huu <fbuihuu@gmail.com>2013-12-02 10:34:29 -0500
committerMichal Marek <mmarek@suse.cz>2014-01-03 08:48:42 -0500
commit7593e0902bc41392315316f1b5f4ba15feead842 (patch)
tree0fefea72a6f43ffd59af98e89b96a51a04ad9bbe /scripts/setlocalversion
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
Fix detectition of kernel git repository in setlocalversion script [take #2]
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> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/setlocalversion')
-rwxr-xr-xscripts/setlocalversion3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index d105a44b68f6..63d91e22ed7c 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -43,7 +43,8 @@ scm_version()
43 fi 43 fi
44 44
45 # Check for git and a git repo. 45 # Check for git and a git repo.
46 if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then 46 if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
47 head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
47 48
48 # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore 49 # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
49 # it, because this version is defined in the top level Makefile. 50 # it, because this version is defined in the top level Makefile.