Skip to content

Commit 111b077

Browse files
authored
Merge pull request #196 from hendrikvanantwerpen/fix-build-reproducability-and-ci-check
Fix build reproducability and CI check
2 parents cc745b7 + 37e3bf2 commit 111b077

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

script/check-generated-files

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
set -eu
44

5-
if ! git diff-index --quiet HEAD -- {tsx,typescript}/src/; then
6-
cat 1>&2 <<EOF
7-
Generated files in the working tree are inconsistent with HEAD.
8-
Make sure to commit generated files in {tsx,typescript}/src/ when the grammar changes.
9-
EOF
5+
## Update index to make sure the subsequent diff-index command only reports
6+
## a change if the file content actually changed. Not updating the index can
7+
## give incorrect results when this script is run right after a build.
8+
9+
git update-index -q --really-refresh
10+
11+
if ! git diff-index --exit-code --name-status HEAD -- {tsx,typescript}/src/; then
12+
echo "The following files are not up to date in the repository:" 1>&2
13+
git diff-index --name-status HEAD 1>&2
14+
echo "Run a build and commit the generated files to resolve this issue." 1>&2
15+
git diff-index -p HEAD
1016
exit 1
1117
fi
1218

0 commit comments

Comments
 (0)