util/lint/checkpatch.pl: Use "git_command"

This is to reduce difference with linux v5.16.

Change-Id: I7abd4d8eed856eee841422515db2ff7f50ecd0a4
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/61471
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Elyes HAOUAS 2022-01-29 08:31:06 +01:00 committed by Martin Roth
parent 41aa8d6035
commit f2a9c8d57c
1 changed files with 5 additions and 4 deletions

View File

@ -64,6 +64,7 @@ my $conststructsfile = "$D/const_structs.checkpatch";
my $typedefsfile = ""; my $typedefsfile = "";
my $color = "auto"; my $color = "auto";
my $allow_c99_comments = 1; my $allow_c99_comments = 1;
my $git_command ='git'; # coreboot
my $tabsize = 8; my $tabsize = 8;
# For coreboot jenkins # For coreboot jenkins
# If taint mode is enabled, Untaint the path - files must be in /bin, /usr/bin or /usr/local/bin # If taint mode is enabled, Untaint the path - files must be in /bin, /usr/bin or /usr/local/bin
@ -870,7 +871,7 @@ sub seed_camelcase_includes {
$camelcase_seeded = 1; $camelcase_seeded = 1;
if (-e "$gitroot") { if (-e "$gitroot") {
my $git_last_include_commit = `git log --no-merges --pretty=format:"%h%n" -1 -- include`; my $git_last_include_commit = `${git_command} 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";
} else { } else {
@ -898,7 +899,7 @@ sub seed_camelcase_includes {
} }
if (-e "$gitroot") { if (-e "$gitroot") {
$files = `git ls-files "include/*.h"`; $files = `${git_command} ls-files "include/*.h"`;
@include_files = split('\n', $files); @include_files = split('\n', $files);
} }
@ -922,7 +923,7 @@ sub git_commit_info {
return ($id, $desc) if ((which("git") eq "") || !(-e "$gitroot")); 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_command} log --no-color --format='%H %s' -1 $commit 2>&1`;
$output =~ s/^\s*//gm; $output =~ s/^\s*//gm;
my @lines = split("\n", $output); my @lines = split("\n", $output);
@ -972,7 +973,7 @@ if ($git) {
} else { } else {
$git_range = "-1 $commit_expr"; $git_range = "-1 $commit_expr";
} }
my $lines = `git log --no-color --no-merges --pretty=format:'%H %s' $git_range`; my $lines = `${git_command} log --no-color --no-merges --pretty=format:'%H %s' $git_range`;
foreach my $line (split(/\n/, $lines)) { foreach my $line (split(/\n/, $lines)) {
$line =~ /^([0-9a-fA-F]{40,40}) (.*)$/; $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/;
next if (!defined($1) || !defined($2)); next if (!defined($1) || !defined($2));