]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t0450: add allowlist for builtins with missing .adoc
authorToon Claes <toon@iotcl.com>
Fri, 8 Aug 2025 09:59:43 +0000 (11:59 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Sep 2025 21:38:34 +0000 (14:38 -0700)
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>
t/t0450-txt-doc-vs-help.sh
t/t0450/adoc-missing [new file with mode: 0644]

index da2d0af5b07810d46c54df5cc8153f80109d25fc..e12e18f97f02eb3c6827389a0e69ffd562bc4737 100755 (executable)
@@ -112,10 +112,19 @@ do
        adoc="$(builtin_to_adoc "$builtin")" &&
        preq="$(echo BUILTIN_ADOC_$builtin | tr '[:lower:]-' '[:upper:]_')" &&
 
-       if test -f "$adoc"
+       # If and only if *.adoc is missing, builtin shall be listed in t0450/adoc-missing.
+       if grep -q "^$builtin$" "$TEST_DIRECTORY"/t0450/adoc-missing
        then
+               test_expect_success "$builtin appropriately marked as not having .adoc" '
+                       ! test -f "$adoc"
+               '
+       else
                test_set_prereq "$preq"
-       fi &&
+
+               test_expect_success "$builtin appropriately marked as having .adoc" '
+                       test -f "$adoc"
+               '
+       fi
 
        # *.adoc output assertions
        test_expect_success "$preq" "$builtin *.adoc SYNOPSIS has dashed labels" '
diff --git a/t/t0450/adoc-missing b/t/t0450/adoc-missing
new file mode 100644 (file)
index 0000000..1ec9f8d
--- /dev/null
@@ -0,0 +1,9 @@
+checkout--worker
+merge-ours
+merge-recursive
+merge-recursive-ours
+merge-recursive-theirs
+merge-subtree
+pickaxe
+submodule--helper
+upload-archive--writer