Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/etc/pre-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# and remove it from .git/hooks to deactivate.
#

set -Eeuo pipefail
set -Euo pipefail

# https://github.com/rust-lang/rust/issues/77620#issuecomment-705144570
unset GIT_DIR
Expand All @@ -15,3 +15,7 @@ echo "Running pre-push script $ROOT_DIR/x test tidy"

cd "$ROOT_DIR"
./x test tidy --set build.locked-deps=true
if [ $? -ne 0 ]; then
Comment on lines 17 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
./x test tidy --set build.locked-deps=true
if [ $? -ne 0 ]; then
res=ok
./x test tidy --set build.locked-deps=true || res=fail
if [ "$res" != 0 ]; then

Probably too late, but you could do something like this to not need to disable the -e flag. Not really needed anyway in this tiny script though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice trick!
but it should be:

if [ "$res" != "ok" ]; then

right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, you're right!

echo "You may use \`git push --no-verify\` to skip this check."
exit 1
fi