]> Kevux Git Server - rit/commitdiff
doc: fix t0450-txt-doc-vs-help to select only first synopsis block
authorJean-Noël Avila <jn.avila@free.fr>
Sat, 20 Dec 2025 19:16:23 +0000 (19:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 21 Dec 2025 02:33:09 +0000 (11:33 +0900)
In case there are multiple synopsis blocks (declared with [synopsis]
or [verse] style) in the same file, the previous implementation was
incorrectly picking up text from all the blocks until the first empty
line. This commit modifies the sed command to stop processing upon
encountering the first empty line after the first block declaration,
thereby ensuring that only the intended block is captured.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0450-txt-doc-vs-help.sh

index e12e18f..822b0d5 100755 (executable)
@@ -56,7 +56,7 @@ adoc_to_synopsis () {
        b2t="$(builtin_to_adoc "$builtin")" &&
        sed -n \
                -E '/^\[(verse|synopsis)\]$/,/^$/ {
-                       /^$/d;
+                       /^$/q;
                        /^\[(verse|synopsis)\]$/d;
                        s/\{litdd\}/--/g;
                        s/'\''(git[ a-z-]*)'\''/\1/g;