Skip to content

Commit

Permalink
Fix detectition of kernel git repository in setlocalversion script [t…
Browse files Browse the repository at this point in the history
…ake #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 <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
fbuihuu authored and michal42 committed Jan 3, 2014
1 parent 6ce4eac commit 7593e09
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/setlocalversion
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7593e09

Please sign in to comment.