Skip to content

Commit bf4c91e

Browse files
committed
doc: test linkgit macros for well-formedness and existence of target
Some readers of man pages have reported that they found malformed linkgit macros in the documentation. This commit adds a test to check that all links to other man pages are made with the linkgit macro, and that the target of the linkgit macro exists. Signed-off-by: Jean-Noël Avila <[email protected]>
1 parent 0e8243a commit bf4c91e

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Documentation/gitweb.conf.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ $export_ok::
178178
Show repository only if this file exists (in repository). Only
179179
effective if this variable evaluates to true. Can be set when
180180
building gitweb by setting `GITWEB_EXPORT_OK`. This path is
181-
relative to `GIT_DIR`. git-daemon[1] uses 'git-daemon-export-ok',
181+
relative to `GIT_DIR`. linkgit:git-daemon[1] uses 'git-daemon-export-ok',
182182
unless started with `--export-all`. By default this variable is
183183
not set, which means that this feature is turned off.
184184

t/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ integration_tests = [
152152
't0410-partial-clone.sh',
153153
't0411-clone-from-partial.sh',
154154
't0450-txt-doc-vs-help.sh',
155+
't0451-well-formed-doc.sh',
155156
't0500-progress-display.sh',
156157
't0600-reffiles-backend.sh',
157158
't0601-reffiles-pack-refs.sh',

t/t0451-well-formed-doc.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
test_description='basic doc format sanity check'
4+
5+
. ./test-lib.sh
6+
7+
test_expect_success 'linkgit macros are well formed' '
8+
(cd $GIT_BUILD_DIR && git grep -r '\''git[-a-z]*\[[0-9]'\'' -- '\''Documentation/**.adoc'\'') | sed -e '\''/linkgit:git/ d'\'' > out &&
9+
test_must_be_empty out
10+
'
11+
12+
test_expect_success 'linkgit macros point to existing files' '
13+
for f in $(cd $GIT_BUILD_DIR && git grep -Ero '\''(linkgit:)[-a-z0-9{}]*'\'' -- '\''Documentation/**.adoc'\'' | cut -f3 -d:| sed -e '\''s/{litdd}/--/g'\'')
14+
do
15+
test_path_is_file $GIT_BUILD_DIR/Documentation/${f}.adoc || return 1
16+
done
17+
'
18+
19+
test_done

0 commit comments

Comments
 (0)