Make update-codegen avoid sub-workspaces

This commit is contained in:
Tim Hockin 2024-02-29 22:10:39 -08:00
parent 21715e6bbd
commit 00e09374b6
No known key found for this signature in database

View File

@ -48,11 +48,20 @@ if [[ "${DBG_CODEGEN}" == 1 ]]; then
kube::log::status "DBG: starting generated_files"
fi
# Generate a list of directories we don't want to play in.
DIRS_TO_AVOID=()
kube::util::read-array DIRS_TO_AVOID < <(
git ls-files -cmo --exclude-standard -- ':!:vendor/*' ':(glob)*/**/go.work' \
| while read -r F; do \
echo ':!:'"$(dirname "${F}")"; \
done
)
function git_find() {
# Similar to find but faster and easier to understand. We want to include
# modified and untracked files because this might be running against code
# which is not tracked by git yet.
git ls-files -cmo --exclude-standard ':!:vendor/*' "$@"
git ls-files -cmo --exclude-standard ':!:vendor/*' "${DIRS_TO_AVOID[@]}" "$@"
}
function git_grep() {
@ -60,7 +69,7 @@ function git_grep() {
# running against code which is not tracked by git yet.
# We need vendor exclusion added at the end since it has to be part of
# the pathspecs which are specified last.
git grep --untracked "$@" ':!:vendor/*'
git grep --untracked "$@" ':!:vendor/*' "${DIRS_TO_AVOID[@]}"
}
# Generate a list of all files that have a `+k8s:` comment-tag. This will be