Skip to content

Commit

Permalink
address review
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander committed Oct 31, 2022
1 parent e73a25a commit a774510
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/verify_genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ set -o errexit
set -o nounset
set -o pipefail

tmpWorkDir=$(mktemp -d -t 'twd.XXXXXX')
mkdir "$tmpWorkDir/etcd"
tmpWorkDir="$tmpWorkDir/etcd"
cp -r . "$tmpWorkDir"
pushd "$tmpWorkDir"
git add -A
git commit -m init || true # maybe fail because nothing to commit
./scripts/genproto.sh
diff=$(git diff --name-only | grep -c ".pb.")
if [ "$diff" -eq 0 ]; then
diff=$(git diff --numstat | awk '{print $3}')
popd
if [ -z "$diff" ]; then
echo "PASSED genproto-verification!"
exit 0
fi
echo "Failed genproto-verification!" >&2
echo "* Found changed files $(git diff --name-only | grep '.pb.')" >&2
printf "* Found changed files:\n%s\n" "$diff" >&2
echo "* Please rerun genproto.sh after changing *.proto file" >&2
echo "* Run ./scripts/genproto.sh" >&2
exit 1

0 comments on commit a774510

Please sign in to comment.