1
0
mirror of https://github.com/git/git synced 2024-07-02 15:48:44 +00:00

Documentation/lint-manpages: bubble up errors

The "lint-manpages.sh" script does not return an error in case any of
its checks fail. While this is faithful to the implementation that we
had as part of the "check-docs" target before the preceding commit, it
makes it hard to spot any violations of the rules via the corresponding
CI job, which will of course exit successfully, too.

Adapt the script to bubble up errors.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-06-06 10:01:05 +02:00 committed by Junio C Hamano
parent 2dd100c513
commit 6423920974

View File

@ -12,7 +12,9 @@ EOF
sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p' sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
} }
check_missing_docs () { check_missing_docs () (
ret=0
for v in $ALL_COMMANDS for v in $ALL_COMMANDS
do do
case "$v" in case "$v" in
@ -32,6 +34,7 @@ check_missing_docs () {
if ! test -f "$v.txt" if ! test -f "$v.txt"
then then
echo "no doc: $v" echo "no doc: $v"
ret=1
fi fi
if ! sed -e '1,/^### command list/d' -e '/^#/d' ../command-list.txt | if ! sed -e '1,/^### command list/d' -e '/^#/d' ../command-list.txt |
@ -41,11 +44,15 @@ check_missing_docs () {
git) git)
;; ;;
*) *)
echo "no link: $v";; echo "no link: $v"
ret=1
;;
esac esac
fi fi
done done
}
exit $ret
)
check_extraneous_docs () { check_extraneous_docs () {
( (
@ -61,15 +68,19 @@ check_extraneous_docs () {
-e 's/\.txt//' -e 's/\.txt//'
) | ( ) | (
all_commands="$(printf "%s " "$ALL_COMMANDS" "$BUILT_INS" "$EXCLUDED_PROGRAMS" | tr '\n' ' ')" all_commands="$(printf "%s " "$ALL_COMMANDS" "$BUILT_INS" "$EXCLUDED_PROGRAMS" | tr '\n' ' ')"
ret=0
while read how cmd while read how cmd
do do
case " $all_commands " in case " $all_commands " in
*" $cmd "*) ;; *" $cmd "*) ;;
*) *)
echo "removed but $how: $cmd";; echo "removed but $how: $cmd"
ret=1;;
esac esac
done done
exit $ret
) )
} }
@ -77,7 +88,21 @@ BUILT_INS="$(extract_variable BUILT_INS)"
ALL_COMMANDS="$(extract_variable ALL_COMMANDS)" ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)" EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
{ findings=$(
check_missing_docs if ! check_missing_docs
check_extraneous_docs then
} | sort ret=1
fi
if ! check_extraneous_docs
then
ret=1
fi
exit $ret
)
ret=$?
printf "%s" "$findings" | sort
exit $ret