Skip to content

Commit cafd982

Browse files
avargitster
authored andcommitted
doc lint: lint and fix missing "GIT" end sections
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d2c9908 commit cafd982

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

Documentation/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,8 @@ lint-docs::
482482
$(HOWTO_TXT) $(DOC_DEP_TXT) \
483483
--section=1 $(MAN1_TXT) \
484484
--section=5 $(MAN5_TXT) \
485-
--section=7 $(MAN7_TXT)
485+
--section=7 $(MAN7_TXT); \
486+
$(PERL_PATH) lint-man-end-blurb.perl $(MAN_TXT)
486487

487488
ifeq ($(wildcard po/Makefile),po/Makefile)
488489
doc-l10n install-l10n::

Documentation/git-credential.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,7 @@ empty string.
159159
+
160160
Components which are missing from the URL (e.g., there is no
161161
username in the example above) will be left unset.
162+
163+
GIT
164+
---
165+
Part of the linkgit:git[1] suite

Documentation/git-p4.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,3 +762,7 @@ IMPLEMENTATION DETAILS
762762
message indicating the p4 depot location and change number. This
763763
line is used by later 'git p4 sync' operations to know which p4
764764
changes are new.
765+
766+
GIT
767+
---
768+
Part of the linkgit:git[1] suite

Documentation/gitnamespaces.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,7 @@ git clone ext::'git --namespace=foo %s /tmp/prefixed.git'
6262
----------
6363

6464
include::transfer-data-leaks.txt[]
65+
66+
GIT
67+
---
68+
Part of the linkgit:git[1] suite

Documentation/lint-man-end-blurb.perl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/perl
2+
3+
use strict;
4+
use warnings;
5+
6+
my $exit_code = 0;
7+
sub report {
8+
my ($target, $msg) = @_;
9+
print "error: $target: $msg\n";
10+
$exit_code = 1;
11+
}
12+
13+
local $/;
14+
while (my $slurp = <>) {
15+
report($ARGV, "has no 'Part of the linkgit:git[1] suite' end blurb")
16+
unless $slurp =~ m[
17+
^GIT\n
18+
---\n
19+
\QPart of the linkgit:git[1] suite\E \n
20+
\z
21+
]mx;
22+
}
23+
24+
exit $exit_code;

0 commit comments

Comments
 (0)