checksrc-all.pl: do not check files multiple times

Restrict `git ls-files` to return `*.[ch]` files within `$dir` only.
Before this patch it returned files in subdirectories too, which did
double work and may have made `checksrc.pl` pick `.checksrc` from the
first such subdirectory, masking the one in `$dir`. (current curl tree
is not affected)

Ref: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec

Follow-up to 33f606cd51 #20439

Closes #21909
This commit is contained in:
Viktor Szakats 2026-06-08 13:56:49 +02:00
parent 7de0a7e71a
commit 2dfd265d66
No known key found for this signature in database

View file

@ -34,7 +34,7 @@ my $anyfailed = 0;
for my $dir (@dirs) {
if($is_git) {
@files = ();
open(O, '-|', 'git', 'ls-files', "$dir/*.[ch]") || die; push @files, <O>; close(O);
open(O, '-|', 'git', 'ls-files', ":(glob)$dir/*.[ch]") || die; push @files, <O>; close(O);
chomp(@files);
}
else {