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