]> git.ipfire.org Git - thirdparty/git.git/commitdiff
doc lint: lint and fix missing "GIT" end sections
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 9 Apr 2021 15:02:48 +0000 (17:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 11 Apr 2021 06:36:34 +0000 (23:36 -0700)
Lint for and fix the three manual pages that were missing the standard
"Part of the linkgit:git[1] suite" end section.

We only do this for the man[157] section documents (we don't have
anything outside those sections), not files to be included,
howto *.txt files etc.

We could also add this to the existing (and then renamed)
lint-gitlink.perl, but I'm not doing that here.

Obviously all of that fits in one script, but I think for something
like this that's a one-off script with global variables it's much
harder to follow when a large part of your script is some if/else or
keeping/resetting of state simply to work around the script doing two
things instead of one.

Especially because in this case this script wants to process the file
as one big string, but lint-gitlink.perl wants to look at it one line
at a time. We could also consolidate this whole thing and
t/check-non-portable-shell.pl, but that one likes to join lines as
part of its shell parsing.

So let's just add another script, whole scaffolding is basically:

    use strict;
    use warnings;
    sub report { ... }
    my $code = 0;
    while (<>) { ... }
    exit $code;

We'd spend more lines effort trying to consolidate them than just
copying that around.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/Makefile
Documentation/git-credential.txt
Documentation/git-p4.txt
Documentation/gitnamespaces.txt
Documentation/lint-man-end-blurb.perl [new file with mode: 0755]

index de55c4ecf52dc20c0bc2364a4fbbfa527e66a169..34b4f5716ab03c90d8e2bc9abe01845714dee62a 100644 (file)
@@ -482,7 +482,8 @@ lint-docs::
                $(HOWTO_TXT) $(DOC_DEP_TXT) \
                --section=1 $(MAN1_TXT) \
                --section=5 $(MAN5_TXT) \
-               --section=7 $(MAN7_TXT)
+               --section=7 $(MAN7_TXT); \
+       $(PERL_PATH) lint-man-end-blurb.perl $(MAN_TXT)
 
 ifeq ($(wildcard po/Makefile),po/Makefile)
 doc-l10n install-l10n::
index 31c81c4c0263ec33db2e7837c2ab70bb626a67d8..206e3c5f407a87e818eb63620488ebbe56d90383 100644 (file)
@@ -159,3 +159,7 @@ empty string.
 +
 Components which are missing from the URL (e.g., there is no
 username in the example above) will be left unset.
+
+GIT
+---
+Part of the linkgit:git[1] suite
index f89e68b424c3b229d77a9495839f8ee0a2dad1c5..38e5257b2a408275f801ac3104134d510c104d49 100644 (file)
@@ -762,3 +762,7 @@ IMPLEMENTATION DETAILS
   message indicating the p4 depot location and change number.  This
   line is used by later 'git p4 sync' operations to know which p4
   changes are new.
+
+GIT
+---
+Part of the linkgit:git[1] suite
index b614969ad2c12b5c4ed337617d7f4dd559a4d278..1c8d2ecc358d805b6b45b58ad36c65411f8cf3f0 100644 (file)
@@ -62,3 +62,7 @@ git clone ext::'git --namespace=foo %s /tmp/prefixed.git'
 ----------
 
 include::transfer-data-leaks.txt[]
+
+GIT
+---
+Part of the linkgit:git[1] suite
diff --git a/Documentation/lint-man-end-blurb.perl b/Documentation/lint-man-end-blurb.perl
new file mode 100755 (executable)
index 0000000..d69312e
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $exit_code = 0;
+sub report {
+       my ($target, $msg) = @_;
+       print "error: $target: $msg\n";
+       $exit_code = 1;
+}
+
+local $/;
+while (my $slurp = <>) {
+       report($ARGV, "has no 'Part of the linkgit:git[1] suite' end blurb")
+               unless $slurp =~ m[
+               ^GIT\n
+                ---\n
+               \QPart of the linkgit:git[1] suite\E \n
+               \z
+       ]mx;
+}
+
+exit $exit_code;