mirror of
https://github.com/curl/curl.git
synced 2026-04-15 01:01:41 +03:00
checksrc-all.pl: skip non-repository files
To avoid noise due to local C files when using automatic local checksrc checks (e.g. via CMake `-DCURL_LINT=ON` option, or `curl-lint` target). Also replace single-quote with double-quote in external git command, for portability. Follow-up to88ff396549#17882 Follow-up toe785e898a6#17376 Closes #20439
This commit is contained in:
parent
9b20a672b8
commit
33f606cd51
1 changed files with 10 additions and 2 deletions
|
|
@ -11,8 +11,10 @@ use File::Find;
|
|||
use Cwd 'abs_path';
|
||||
|
||||
my @files;
|
||||
my $is_git = 0;
|
||||
if(system('git rev-parse --is-inside-work-tree >/dev/null 2>&1') == 0) {
|
||||
@files = `git ls-files '*.[ch]'`;
|
||||
@files = `git ls-files \"*.[ch]\"`;
|
||||
$is_git = 1;
|
||||
}
|
||||
else {
|
||||
find(sub { if(/\.[ch]$/) { push(@files, $File::Find::name) } }, ('.'));
|
||||
|
|
@ -30,7 +32,13 @@ my $scripts_dir = dirname(abs_path($0));
|
|||
my $anyfailed = 0;
|
||||
|
||||
for my $dir (@dirs) {
|
||||
@files = glob("$dir/*.[ch]");
|
||||
if($is_git) {
|
||||
@files = `git ls-files \"$dir/*.[ch]\"`;
|
||||
chomp(@files);
|
||||
}
|
||||
else {
|
||||
@files = glob("$dir/*.[ch]");
|
||||
}
|
||||
if(@files && system("$scripts_dir/checksrc.pl", @files) != 0) {
|
||||
$anyfailed = 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue