Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User may want to skip tidy check sometimes #113206

Merged
merged 1 commit into from
Jul 1, 2023
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