]> git.ipfire.org Git - thirdparty/git.git/commitdiff
lint-gitlink: preemptively ignore all /ifn?def|endif/ macros
authorJean-Noël Avila <jn.avila@free.fr>
Wed, 21 Jan 2026 13:27:05 +0000 (14:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 21 Jan 2026 16:26:00 +0000 (08:26 -0800)
Instead of testing if the macro name is ifn?def:: as if it were a inline
macro, it is faster and safer to just ignore such block macro lines before
hand.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/lint-gitlink.perl

index f183a18df28466adbae81df5c18c0c6f1656c2ae..a92e887b4c75f29571a0b669fd2ac2afee22c3c4 100755 (executable)
@@ -41,10 +41,11 @@ die "BUG: No list of valid linkgit:* files given" unless @ARGV;
 @ARGV = $to_check;
 while (<>) {
        my $line = $_;
+       next if $line =~ /^\s*(ifn?def|endif)::/;
        while ($line =~ m/(.{,8})((git[-a-z]+|scalar)\[(\d)*\])/g) {
            my $pos = pos $line;
            my ($macro, $target, $page, $section) = ($1, $2, $3, $4);
-               if ( $macro ne "linkgit:" && $macro !~ "ifn?def::" && $macro ne "endif::" ) {
+               if ( $macro ne "linkgit:" ) {
                        report($pos, $line, $target, "linkgit: macro expected");
                }
        }