]> Pileus Git - ~andy/linux/commitdiff
checkpatch: fix detection of git repository
authorRichard Genoud <richard.genoud@gmail.com>
Mon, 10 Feb 2014 22:25:32 +0000 (14:25 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 11 Feb 2014 00:01:40 +0000 (16:01 -0800)
Since git v1.7.7, the .git directory can be a file when, for example,
the kernel is a submodule of another git super project.  So, the check
"-d .git" is not working anymore in this case.  Using a more generic
check like "-e .git" corrects this behaviour.

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 0ea2a1e24ade493ed22c6b817c91a07736b11563..464dcef79b353be5426115fb3fb8ba1f746546df 100755 (executable)
@@ -471,7 +471,7 @@ sub seed_camelcase_includes {
 
        $camelcase_seeded = 1;
 
-       if (-d ".git") {
+       if (-e ".git") {
                my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`;
                chomp $git_last_include_commit;
                $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
@@ -499,7 +499,7 @@ sub seed_camelcase_includes {
                return;
        }
 
-       if (-d ".git") {
+       if (-e ".git") {
                $files = `git ls-files "include/*.h"`;
                @include_files = split('\n', $files);
        }