-
Notifications
You must be signed in to change notification settings - Fork 306
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
DAOS-16898 cq: support user bash in githooks #15648
Conversation
Replace hardcoded /bin/bash with /usr/bin/env bash in the githook scripts, for the case where /bin/bash does not support newer features like, e.g., mapfile. Skip-test: true Skip-tests: true SKip-unit-tests: true Skip-nlt: true Required-githooks: true Signed-off-by: Dalton Bohning <[email protected]>
Ticket title is 'githooks: support user bash' |
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.
LGTM. Tested on MacOS and the changes work,
Skip-test: true Skip-tests: true Skip-unit-tests: true Skip-nlt: true Required-githooks: true Signed-off-by: Dalton Bohning <[email protected]>
Skip-test: true Skip-tests: true Skip-unit-tests: true Skip-nlt: true Required-githooks: true Signed-off-by: Dalton Bohning <[email protected]>
Skip-test: true Skip-tests: true Skip-unit-tests: true Skip-nlt: true Signed-off-by: Dalton Bohning <[email protected]>
Skip-test: true Skip-tests: true Skip-unit-tests: true Skip-nlt: true Signed-off-by: Dalton Bohning <[email protected]>
utils/githooks/hook_base.sh
Outdated
@@ -31,6 +32,7 @@ export -f _git_diff_cached_files | |||
hook=${0##*/} | |||
rm -f ".${hook}" | |||
|
|||
skip_list=() |
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.
Unfortunately, this does not fix the problem in my testing: With or without this line, I get the same "unbound variable" error. Some reading shows that the read -a v
builtin command unsets v
at the beginning. If we really want to keep set -u
, then the following works for me:
@@ -41,7 +41,7 @@ run-parts() {
# don't run vim .swp files
[ "${i%.sw?}" != "${i}" ] && continue
skip_item=false
- for skip in "${skip_list[@]}"; do
+ for skip in "${skip_list[@]:-}"; do
if [[ "${i}" =~ ${skip} ]]; then
skip_item=true
echo "Skipping ${i}"
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.
Thanks. Pushed :)
while IFS= read -r base; do | ||
all_bases+=("$base") | ||
done < <(echo "master" | ||
git branch -r | sed -ne "/^ $origin\\/release\\/\(2.[4-9]\|[3-9]\)/s/^ $origin\\///p") |
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.
This works for me.
Skip-test: true Skip-tests: true Skip-unit-tests: true Skip-nlt: true Signed-off-by: Dalton Bohning <[email protected]>
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.
Except the copyright string fix mentioned by Phil, everything looks good to me.
@@ -1,6 +1,7 @@ | |||
#!/bin/bash | |||
#!/usr/bin/env bash | |||
# | |||
# Copyright 2023-2024 Intel Corporation. |
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.
Is there any specific reason why Intel copyright years differ on each file? It maybe related to the file creation date... Still seems little confusing... some files have 2024 alone, 2022-2024, 2023-2024, etc... Anyway, it's minor issue.,
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.
That is intended. Copyright on a file begins when it is created
Skip-test: true Skip-tests: true SKip-unit-tests: true Skip-nlt: true Signed-off-by: Dalton Bohning <[email protected]>
Skip-test: true Skip-tests: true SKip-unit-tests: true Skip-nlt: true Signed-off-by: Dalton Bohning <[email protected]>
Skip-test: true Skip-tests: true SKip-unit-tests: true Skip-nlt: true Signed-off-by: Dalton Bohning <[email protected]>
Skip-test: true Skip-tests: true SKip-unit-tests: true Skip-nlt: true Signed-off-by: Dalton Bohning <[email protected]>
Replace hardcoded /bin/bash with /usr/bin/env bash in the githook scripts, for the case where /bin/bash does not support newer features like, e.g., mapfile.
Skip-test: true
Skip-tests: true
SKip-unit-tests: true
Skip-nlt: true
Required-githooks: true
Before requesting gatekeeper:
Features:
(orTest-tag*
) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.Gatekeeper: