-
Notifications
You must be signed in to change notification settings - Fork 835
Arm backend: Use symbolic links for dev pre-commit/push hooks #17411
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,9 +1,9 @@ | ||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||
| # Copyright 2025 Arm Limited and/or its affiliates. | ||||||||||||||||||
| # Copyright 2025-2026 Arm Limited and/or its affiliates. | ||||||||||||||||||
| # | ||||||||||||||||||
| # This source code is licensed under the BSD-style license found in the | ||||||||||||||||||
| # LICENSE file in the root directory of this source tree. | ||||||||||||||||||
|
|
||||||||||||||||||
| git_dir=$(git rev-parse --git-dir) | ||||||||||||||||||
| ln $git_dir/../backends/arm/scripts/pre-push $git_dir/hooks | ||||||||||||||||||
| ln $git_dir/../backends/arm/scripts/pre-commit $git_dir/hooks | ||||||||||||||||||
| ln -s "$(realpath "$git_dir/../backends/arm/scripts/pre-push")" "$(realpath "$git_dir")/hooks" | ||||||||||||||||||
| ln -s "$(realpath "$git_dir/../backends/arm/scripts/pre-commit")" "$(realpath "$git_dir")/hooks" | ||||||||||||||||||
|
Comment on lines
+8
to
+9
|
||||||||||||||||||
| ln -s "$(realpath "$git_dir/../backends/arm/scripts/pre-push")" "$(realpath "$git_dir")/hooks" | |
| ln -s "$(realpath "$git_dir/../backends/arm/scripts/pre-commit")" "$(realpath "$git_dir")/hooks" | |
| mkdir -p "$git_dir/hooks" | |
| ( | |
| cd "$git_dir/hooks" || exit 1 | |
| ln -s "../../backends/arm/scripts/pre-push" pre-push | |
| ln -s "../../backends/arm/scripts/pre-commit" pre-commit | |
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ln -s SOURCE DESTDIRonly works as intended ifDESTDIRalready exists and is a directory; otherwise it will create a symlink namedhooks(or fail), which is not what you want for Git hooks. Consider linking to explicit destination filenames (e.g.,.../hooks/pre-pushand.../hooks/pre-commit) and making the script idempotent by using-f(or removing existing hooks first).