Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kubernetes-sigs/kubebuilder
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dc89be4430ec153cabcd8ec5c7d54f517e955294
Choose a base ref
..
head repository: kubernetes-sigs/kubebuilder
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8f86fbae565eeda4273bb8528710bfd6ef16cfcf
Choose a head ref
Showing with 7 additions and 10 deletions.
  1. +7 −10 test/testdata/check.sh
17 changes: 7 additions & 10 deletions test/testdata/check.sh
Original file line number Diff line number Diff line change
@@ -18,25 +18,22 @@ source "$(dirname "$0")/../common.sh"

check_directory="$(dirname "$0")/../../testdata"

# Check if there are any uncommitted changes before running the test
# Check testdata directory first. If there are any uncommitted change, fail the test.
if [[ $(git status ${check_directory} --porcelain) ]]; then
header_text "Generate Testdata test precondition failed!"
header_text "Please commit the changes under testdata directory before running the Generate Testdata test"
header_text "Please commit the change under testdata directory before running the Generate Testdata test"
exit 1
fi

$(dirname "$0")/generate.sh

# Ignore changes in specific files
excluded_files="wordpress_types.go|firstmate_types.go"
diff_output=$(git diff ${check_directory} | grep -Ev "${excluded_files}")

# Check if there are any changes, excluding the specified files
if [[ -n "$diff_output" ]]; then
echo "$diff_output"
# Check if there are any changes to files under testdata directory.
if [[ $(git status ${check_directory} --porcelain) ]]; then
git status ${check_directory} --porcelain
git diff ${check_directory}
header_text "Generate Testdata failed!"
header_text "Please, if you have changed the scaffolding make sure you have run: make generate"
exit 1
else
header_text "Generate Testdata passed! Ignored expected differences in specific files."
header_text "Generate Testdata passed!"
fi