From f2a9c8d57ce44ddab45928cb77a48b44a615e8d0 Mon Sep 17 00:00:00 2001 From: Elyes HAOUAS Date: Sat, 29 Jan 2022 08:31:06 +0100 Subject: [PATCH] util/lint/checkpatch.pl: Use "git_command" This is to reduce difference with linux v5.16. Change-Id: I7abd4d8eed856eee841422515db2ff7f50ecd0a4 Signed-off-by: Elyes HAOUAS Reviewed-on: https://review.coreboot.org/c/coreboot/+/61471 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- util/lint/checkpatch.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/util/lint/checkpatch.pl b/util/lint/checkpatch.pl index cd188e6bd4..3cf249c4ed 100755 --- a/util/lint/checkpatch.pl +++ b/util/lint/checkpatch.pl @@ -64,6 +64,7 @@ my $conststructsfile = "$D/const_structs.checkpatch"; my $typedefsfile = ""; my $color = "auto"; my $allow_c99_comments = 1; +my $git_command ='git'; # coreboot my $tabsize = 8; # For coreboot jenkins # 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; 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; $camelcase_cache = ".checkpatch-camelcase.git.$git_last_include_commit"; } else { @@ -898,7 +899,7 @@ sub seed_camelcase_includes { } if (-e "$gitroot") { - $files = `git ls-files "include/*.h"`; + $files = `${git_command} ls-files "include/*.h"`; @include_files = split('\n', $files); } @@ -922,7 +923,7 @@ sub git_commit_info { 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; my @lines = split("\n", $output); @@ -972,7 +973,7 @@ if ($git) { } else { $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)) { $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/; next if (!defined($1) || !defined($2));