-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add a command to install a git hook to automatically run x.py test tidy --bless
#76356
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
Changes from 4 commits
a009e28
44af74f
7de557b
f53d436
68ca474
d585c96
0845627
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/env bash | ||
# | ||
# Call `tidy --bless` before each commit | ||
# Copy this scripts to .git/hooks to activate, | ||
# and remove it from .git/hooks to deactivate. | ||
# | ||
# For help running bash scripts on Windows, | ||
# see https://stackoverflow.com/a/6413405/6894799 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, maybe a good follow-up would be to have a version of this for powershell too. No need to add it now though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I can tell, git only understands unix-like scripts, and won't run e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @mati865 - do you know if this will work on windows, and if not, how to make it work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jyn514 Git for Windows ships bash shell. I hate powershell so personally I use bash/zsh everywhere, even on Windows. |
||
# | ||
|
||
set -Eeuo pipefail | ||
|
||
ROOT_DIR="$(git rev-parse --show-toplevel)"; | ||
COMMAND="$ROOT_DIR/x.py test tidy --bless"; | ||
caass marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then | ||
COMMAND="python $COMMAND" | ||
fi | ||
|
||
echo "Running pre-commit script $COMMAND"; | ||
caass marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
$COMMAND; |
Uh oh!
There was an error while loading. Please reload this page.