From 27ad623b3d1343e541bf87a6254319be01879504 Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Mon, 27 Mar 2023 13:37:25 +0200 Subject: [PATCH] Skip vendor directory when removing generated files --- hack/update-codegen.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 183e1bea2a5..37d6ca15534 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -52,13 +52,15 @@ 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 "$@" + git ls-files -cmo --exclude-standard ':!:vendor/*' "$@" } function git_grep() { # We want to include modified and untracked files because this might be # running against code which is not tracked by git yet. - git grep --untracked "$@" + # 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/*' } # Generate a list of all files that have a `+k8s:` comment-tag. This will be @@ -77,7 +79,6 @@ kube::util::read-array ALL_K8S_TAG_FILES < <( git_grep -l \ -e '^// *+k8s:' `# match +k8s: tags` \ -- \ - ':!:vendor/*' `# not under vendor` \ ':!:*/testdata/*' `# not under any testdata` \ ':(glob)**/*.go' `# in any *.go file` \ | sed 's|^staging/src|vendor|' `# see comments above` \