]> git.ipfire.org Git - thirdparty/git.git/commitdiff
doc: test linkgit macros for well-formedness
authorJean-Noël Avila <jn.avila@free.fr>
Mon, 11 Aug 2025 20:53:15 +0000 (20:53 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Aug 2025 21:16:03 +0000 (14:16 -0700)
Some readers of man pages have reported that they found
malformed linkgit macros in the documentation (absence or bad
spelling).

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

index 1348e9b12504db32d2b9c5870b50a89595f31934..64bebb811c97717874c09598b4f47984743a48b2 100644 (file)
@@ -178,7 +178,7 @@ $export_ok::
        Show repository only if this file exists (in repository).  Only
        effective if this variable evaluates to true.  Can be set when
        building gitweb by setting `GITWEB_EXPORT_OK`.  This path is
-       relative to `GIT_DIR`.  git-daemon[1] uses 'git-daemon-export-ok',
+       relative to `GIT_DIR`.  linkgit:git-daemon[1] uses 'git-daemon-export-ok',
        unless started with `--export-all`.  By default this variable is
        not set, which means that this feature is turned off.
 
index aea564dad7edbd7b835c40af4219810dfe1df564..f183a18df28466adbae81df5c18c0c6f1656c2ae 100755 (executable)
@@ -41,6 +41,13 @@ die "BUG: No list of valid linkgit:* files given" unless @ARGV;
 @ARGV = $to_check;
 while (<>) {
        my $line = $_;
+       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::" ) {
+                       report($pos, $line, $target, "linkgit: macro expected");
+               }
+       }
        while ($line =~ m/linkgit:((.*?)\[(\d)\])/g) {
                my $pos = pos $line;
                my ($target, $page, $section) = ($1, $2, $3);