From a6e60f043bc626eac58074a6b64ef04f00071f96 Mon Sep 17 00:00:00 2001 From: Solomon Alan-Dei Date: Thu, 11 Aug 2022 11:13:28 -0600 Subject: [PATCH] util/lint: fall back to regular grep in kconfig_lint Automatically fall back to using regular grep if working outside a git repository and the option to use regular grep is not specified Signed-off-by: Solomon Alan-Dei Change-Id: I0cdecf01a0e74c30947c4fe7e7c7d9457a5165a1 Reviewed-on: https://review.coreboot.org/c/coreboot/+/66637 Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth --- util/lint/kconfig_lint | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/lint/kconfig_lint b/util/lint/kconfig_lint index 32bf92dc4d..f2a732d92b 100755 --- a/util/lint/kconfig_lint +++ b/util/lint/kconfig_lint @@ -58,7 +58,12 @@ Main(); #------------------------------------------------------------------------------- sub Main { - check_arguments(); + check_arguments(); + if ( !($dont_use_git_grep || `git rev-parse --is-inside-work-tree`) ) { + $dont_use_git_grep = 1; + print STDERR "\nGit grep unavailable, falling back to regular grep...\n"; + } + open( STDOUT, "> $output_file" ) or die "Can't open $output_file for output: $!\n"; if ( defined $top_dir ) {