Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

checkpatch: enable GIT_DIR environment use to set git repository location

If set, use the environment variable GIT_DIR to change the default .git
location of the kernel git tree.

If GIT_DIR is unset, keep using the current ".git" default.

Link: https://lkml.kernel.org/r/c5e23b45562373d632fccb8bc04e563abba4dd1d.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Joe Perches and committed by
Linus Torvalds
0f7f635b 672f8871

+7 -5
+7 -5
scripts/checkpatch.pl
··· 43 43 my $fix = 0; 44 44 my $fix_inplace = 0; 45 45 my $root; 46 + my $gitroot = $ENV{'GIT_DIR'}; 47 + $gitroot = ".git" if !defined($gitroot); 46 48 my %debug; 47 49 my %camelcase = (); 48 50 my %use_type = (); ··· 910 908 sub is_SPDX_License_valid { 911 909 my ($license) = @_; 912 910 913 - return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$root/.git")); 911 + return 1 if (!$tree || which("python") eq "" || !(-e "$root/scripts/spdxcheck.py") || !(-e "$gitroot")); 914 912 915 913 my $root_path = abs_path($root); 916 914 my $status = `cd "$root_path"; echo "$license" | python scripts/spdxcheck.py -`; ··· 928 926 929 927 $camelcase_seeded = 1; 930 928 931 - if (-e ".git") { 929 + if (-e "$gitroot") { 932 930 my $git_last_include_commit = `${git_command} log --no-merges --pretty=format:"%h%n" -1 -- include`; 933 931 chomp $git_last_include_commit; 934 932 $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; ··· 956 954 return; 957 955 } 958 956 959 - if (-e ".git") { 957 + if (-e "$gitroot") { 960 958 $files = `${git_command} ls-files "include/*.h"`; 961 959 @include_files = split('\n', $files); 962 960 } ··· 989 987 sub git_commit_info { 990 988 my ($commit, $id, $desc) = @_; 991 989 992 - return ($id, $desc) if ((which("git") eq "") || !(-e ".git")); 990 + return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot")); 993 991 994 992 my $output = `${git_command} log --no-color --format='%H %s' -1 $commit 2>&1`; 995 993 $output =~ s/^\s*//gm; ··· 1028 1026 1029 1027 # If input is git commits, extract all commits from the commit expressions. 1030 1028 # For example, HEAD-3 means we need check 'HEAD, HEAD~1, HEAD~2'. 1031 - die "$P: No git repository found\n" if ($git && !-e ".git"); 1029 + die "$P: No git repository found\n" if ($git && !-e "$gitroot"); 1032 1030 1033 1031 if ($git) { 1034 1032 my @commits = ();