HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/61470 )
Change subject: util/lint/checkpatch.pl: Use "gitroot" ......................................................................
util/lint/checkpatch.pl: Use "gitroot"
This is to reduce difference with linux v5.16.
Change-Id: I3bdf880c8b6068467665865b7cf1249d1047e833 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M util/lint/checkpatch.pl 1 file changed, 6 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/61470/1
diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index fdf6818..bce724d 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -42,6 +42,8 @@ my $fix = 0; my $fix_inplace = 0; my $root = $P; #coreboot +my $gitroot = $ENV{'GIT_DIR'}; +$gitroot = ".git" if !defined($gitroot); my %debug; my %camelcase = (); my %use_type = (); @@ -867,7 +869,7 @@
$camelcase_seeded = 1;
- if (-e ".git") { + if (-e "$gitroot") { 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"; @@ -895,7 +897,7 @@ return; }
- if (-e ".git") { + if (-e "$gitroot") { $files = `git ls-files "include/*.h"`; @include_files = split('\n', $files); } @@ -918,7 +920,7 @@ sub git_commit_info { my ($commit, $id, $desc) = @_;
- return ($id, $desc) if ((which("git") eq "") || !(-e ".git")); + return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot"));
my $output = `git log --no-color --format='%H %s' -1 $commit 2>&1`; $output =~ s/^\s*//gm; @@ -957,7 +959,7 @@
# If input is git commits, extract all commits from the commit expressions. # For example, HEAD-3 means we need check 'HEAD, HEAD~1, HEAD~2'. -die "$P: No git repository found\n" if ($git && !-e ".git"); +die "$P: No git repository found\n" if ($git && !-e "$gitroot");
if ($git) { my @commits = ();