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> Reviewed-on: https://review.coreboot.org/c/coreboot/+/61470 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
249c4044c2
commit
18ef52083d
|
@ -42,6 +42,8 @@ my $list_types = 0;
|
||||||
my $fix = 0;
|
my $fix = 0;
|
||||||
my $fix_inplace = 0;
|
my $fix_inplace = 0;
|
||||||
my $root = $P; #coreboot
|
my $root = $P; #coreboot
|
||||||
|
my $gitroot = $ENV{'GIT_DIR'};
|
||||||
|
$gitroot = ".git" if !defined($gitroot);
|
||||||
my %debug;
|
my %debug;
|
||||||
my %camelcase = ();
|
my %camelcase = ();
|
||||||
my %use_type = ();
|
my %use_type = ();
|
||||||
|
@ -867,7 +869,7 @@ sub seed_camelcase_includes {
|
||||||
|
|
||||||
$camelcase_seeded = 1;
|
$camelcase_seeded = 1;
|
||||||
|
|
||||||
if (-e ".git") {
|
if (-e "$gitroot") {
|
||||||
my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`;
|
my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`;
|
||||||
chomp $git_last_include_commit;
|
chomp $git_last_include_commit;
|
||||||
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
|
$camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit";
|
||||||
|
@ -895,7 +897,7 @@ sub seed_camelcase_includes {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-e ".git") {
|
if (-e "$gitroot") {
|
||||||
$files = `git ls-files "include/*.h"`;
|
$files = `git ls-files "include/*.h"`;
|
||||||
@include_files = split('\n', $files);
|
@include_files = split('\n', $files);
|
||||||
}
|
}
|
||||||
|
@ -918,7 +920,7 @@ sub seed_camelcase_includes {
|
||||||
sub git_commit_info {
|
sub git_commit_info {
|
||||||
my ($commit, $id, $desc) = @_;
|
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`;
|
my $output = `git log --no-color --format='%H %s' -1 $commit 2>&1`;
|
||||||
$output =~ s/^\s*//gm;
|
$output =~ s/^\s*//gm;
|
||||||
|
@ -957,7 +959,7 @@ my $fixlinenr = -1;
|
||||||
|
|
||||||
# If input is git commits, extract all commits from the commit expressions.
|
# 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'.
|
# 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) {
|
if ($git) {
|
||||||
my @commits = ();
|
my @commits = ();
|
||||||
|
|
Loading…
Reference in New Issue