t0450: add allowlist for builtins with missing .adoc
Before we were silently skipping all builtins that don't have a matching .adoc file. This is overly loose and might skip documentation files when it shouldn't, for example when there was a typo in the filename. To ensure no new builtins are added without documentation, add an allowlist: t0450/adoc-missing. In this file only builtin commands that do *not* have a corresponding .adoc file shall be listed. If there is a mismatch, fail the test. This should force future contributions to either add an .adoc, or add the builtin name to the allowlist file. Signed-off-by: Toon Claes <toon@iotcl.com> [jc: squashed Patrick's "missing file fix" in] Signed-off-by: Junio C Hamano <gitster@pobox.com>
Toon Claes committed
Aug 8, 2025 at 11:59 UTC
f9a6705d9a1012bc5349a9f010fee3abbf8c53e6
2 files changed
+20
-2
t/t0450-txt-doc-vs-help.sh
+11
-2
@@ -112,10 +112,19 @@ do
112
adoc="$(builtin_to_adoc "$builtin")" &&
113
preq="$(echo BUILTIN_ADOC_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
114
115
- if test -f "$adoc"
115
+ # If and only if *.adoc is missing, builtin shall be listed in t0450/adoc-missing.
116
+ if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/adoc-missing
117
then
118
+ test_expect_success "$builtin appropriately marked as not having .adoc" '
119
+ ! test -f "$adoc"
120
+ '
121
+ else
122
test_set_prereq "$preq"
118
- fi &&
123
+
124
+ test_expect_success "$builtin appropriately marked as having .adoc" '
125
+ test -f "$adoc"
126
+ '
127
+ fi
128
129
# *.adoc output assertions
130
test_expect_success "$preq" "$builtin *.adoc SYNOPSIS has dashed labels" '
t/t0450/adoc-missing
new
+9
@@ -0,0 +1,9 @@
1
+checkout--worker
2
+merge-ours
3
+merge-recursive
4
+merge-recursive-ours
5
+merge-recursive-theirs
6
+merge-subtree
7
+pickaxe
8
+submodule--helper
9
+upload-archive--writer