Skip to content

Commit 6423920

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2dd100c commit 6423920

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

Documentation/lint-manpages.sh

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ EOF
1212
sed -n -e 's/.*XXX \(.*\) YYY.*/\1/p'
1313
}
1414

15-
check_missing_docs () {
15+
check_missing_docs () (
16+
ret=0
17+
1618
for v in $ALL_COMMANDS
1719
do
1820
case "$v" in
@@ -32,6 +34,7 @@ check_missing_docs () {
3234
if ! test -f "$v.txt"
3335
then
3436
echo "no doc: $v"
37+
ret=1
3538
fi
3639

3740
if ! sed -e '1,/^### command list/d' -e '/^#/d' ../command-list.txt |
@@ -41,11 +44,15 @@ check_missing_docs () {
4144
git)
4245
;;
4346
*)
44-
echo "no link: $v";;
47+
echo "no link: $v"
48+
ret=1
49+
;;
4550
esac
4651
fi
4752
done
48-
}
53+
54+
exit $ret
55+
)
4956

5057
check_extraneous_docs () {
5158
(
@@ -61,23 +68,41 @@ check_extraneous_docs () {
6168
-e 's/\.txt//'
6269
) | (
6370
all_commands="$(printf "%s " "$ALL_COMMANDS" "$BUILT_INS" "$EXCLUDED_PROGRAMS" | tr '\n' ' ')"
71+
ret=0
6472

6573
while read how cmd
6674
do
6775
case " $all_commands " in
6876
*" $cmd "*) ;;
6977
*)
70-
echo "removed but $how: $cmd";;
78+
echo "removed but $how: $cmd"
79+
ret=1;;
7180
esac
7281
done
82+
83+
exit $ret
7384
)
7485
}
7586

7687
BUILT_INS="$(extract_variable BUILT_INS)"
7788
ALL_COMMANDS="$(extract_variable ALL_COMMANDS)"
7889
EXCLUDED_PROGRAMS="$(extract_variable EXCLUDED_PROGRAMS)"
7990

80-
{
81-
check_missing_docs
82-
check_extraneous_docs
83-
} | sort
91+
findings=$(
92+
if ! check_missing_docs
93+
then
94+
ret=1
95+
fi
96+
97+
if ! check_extraneous_docs
98+
then
99+
ret=1
100+
fi
101+
102+
exit $ret
103+
)
104+
ret=$?
105+
106+
printf "%s" "$findings" | sort
107+
108+
exit $ret

0 commit comments

Comments
 (0)