Skip to content

Commit 0286e46

Browse files
authored
Merge pull request #151 from Vogtinator/datefix
helpers/check_dates_in_changes: Fix some false negatives and include line numbers in errors
2 parents e90e51d + 9a605bb commit 0286e46

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

helpers/check_dates_in_changes

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ for CHANGES in "$@" ; do
1818

1919
TROUBLE_FOUND=false
2020

21-
while read LINE ; do
21+
lineno=0
22+
while IFS=$'\n' read -r LINE; do
23+
((lineno++))
2224
case "$LINE" in
2325
--------------*)
2426
# Next line is the changelog entry header
25-
read LINE
27+
IFS=$'\n' read -r LINE
28+
((lineno++))
2629
;;
2730
*)
2831
continue
@@ -55,17 +58,17 @@ for CHANGES in "$@" ; do
5558
\ [MTWFS][a-z][a-z]*)
5659
;;
5760
*)
58-
echo "ERROR: '$DATESTR' is not a date"
61+
echo "ERROR: '$DATESTR' is not a date ($CHANGES:$lineno)"
5962
TROUBLE_FOUND=true
6063
;;
6164
esac
6265
if ! DATE=`date +%s --date "$DATESTR"`; then
63-
TROUBLE_FOUND=true
64-
continue
66+
echo "ERROR: INVALID DATE \"$DATESTR\" ($CHANGES:$lineno)"
67+
TROUBLE_FOUND=true
68+
continue
6569
fi
6670
test $? -gt 0 -o -z "$DATE" -o "$LAST_IS_YEAR" != true -o "$DATE" -gt "$now" && {
67-
echo "$CHANGES"
68-
echo "ERROR: INVALID DATE \"$DATESTR\" "
71+
echo "ERROR: INVALID DATE \"$DATESTR\" ($CHANGES:$lineno)"
6972
TROUBLE_FOUND=true
7073
}
7174
done < "$CHANGES"

0 commit comments

Comments
 (0)