diff --git a/tests/patch/pylint/pylint.sh b/tests/patch/pylint/pylint.sh index 515fe19..6b90b2c 100755 --- a/tests/patch/pylint/pylint.sh +++ b/tests/patch/pylint/pylint.sh @@ -8,8 +8,8 @@ pr() { echo " ====== $@ ======" | tee -a /dev/stderr } -# If it doesn't touch .py files, don't bother. Ignore created and deleted. -if ! git show --diff-filter=AM --pretty="" --name-only HEAD | grep -q -E "\.py$" +# If it doesn't touch .py files, don't bother. Ignore deleted. +if ! git show --diff-filter=AM --pretty="" --name-only "${HEAD}" | grep -q -E "\.py$" then echo "No python scripts touched, skip" >&$DESC_FD exit 0 @@ -28,7 +28,8 @@ git log -1 --pretty='%h ("%s")' HEAD pr "Checking before the patch" git checkout -q HEAD~ -for f in $(git show --diff-filter=M --pretty="" --name-only HEAD | grep -E "\.py$"); do +# Also ignore created, as not present in the parent commit +for f in $(git show --diff-filter=M --pretty="" --name-only "${HEAD}" | grep -E "\.py$"); do pylint $f | tee -a $tmpfile_o done @@ -38,7 +39,7 @@ incumbent_w=$(grep -i -c ": [WC][0-9][0-9][0-9][0-9]: " $tmpfile_o) pr "Checking the tree with the patch" git checkout -q $HEAD -for f in $(git show --diff-filter=AM --pretty="" --name-only HEAD | grep -E "\.py$"); do +for f in $(git show --diff-filter=AM --pretty="" --name-only "${HEAD}" | grep -E "\.py$"); do pylint $f | tee -a $tmpfile_n done diff --git a/tests/patch/shellcheck/shellcheck.sh b/tests/patch/shellcheck/shellcheck.sh index 095c689..a96f648 100755 --- a/tests/patch/shellcheck/shellcheck.sh +++ b/tests/patch/shellcheck/shellcheck.sh @@ -8,8 +8,8 @@ pr() { echo " ====== $@ ======" | tee -a /dev/stderr } -# If it doesn't touch .sh files, don't bother. Ignore created and deleted. -if ! git show --diff-filter=AM --pretty="" --name-only HEAD | grep -q -E "\.sh$" +# If it doesn't touch .sh files, don't bother. Ignore deleted. +if ! git show --diff-filter=AM --pretty="" --name-only "${HEAD}" | grep -q -E "\.sh$" then echo "No shell scripts touched, skip" >&$DESC_FD exit 0 @@ -28,7 +28,8 @@ git log -1 --pretty='%h ("%s")' HEAD pr "Checking before the patch" git checkout -q HEAD~ -for f in $(git show --diff-filter=M --pretty="" --name-only HEAD | grep -E "\.sh$"); do +# Also ignore created, as not present in the parent commit +for f in $(git show --diff-filter=M --pretty="" --name-only "${HEAD}" | grep -E "\.sh$"); do ( echo "Checking $f" echo @@ -45,7 +46,7 @@ incumbent_w=$(grep -i -c "SC[0-9]* (" $tmpfile_o) pr "Building the tree with the patch" git checkout -q $HEAD -for f in $(git show --diff-filter=AM --pretty="" --name-only HEAD | grep -E "\.sh$"); do +for f in $(git show --diff-filter=AM --pretty="" --name-only "${HEAD}" | grep -E "\.sh$"); do ( echo "Checking $f" echo diff --git a/tests/patch/yamllint/yamllint.sh b/tests/patch/yamllint/yamllint.sh index 99efb34..099e9fc 100755 --- a/tests/patch/yamllint/yamllint.sh +++ b/tests/patch/yamllint/yamllint.sh @@ -8,8 +8,8 @@ pr() { echo " ====== $@ ======" | tee -a /dev/stderr } -# If it doesn't touch .yaml files, don't bother. Ignore created and deleted. -if ! git show --diff-filter=AM --pretty="" --name-only HEAD | grep -q -E "\.yaml$" +# If it doesn't touch .yaml files, don't bother. Ignore deleted. +if ! git show --diff-filter=AM --pretty="" --name-only "${HEAD}" | grep -q -E "\.yaml$" then echo "No YAML files touched, skip" >&$DESC_FD exit 0 @@ -28,7 +28,8 @@ git log -1 --pretty='%h ("%s")' HEAD pr "Checking before the patch" git checkout -q HEAD~ -for f in $(git show --diff-filter=M --pretty="" --name-only HEAD | grep -E "\.yaml$"); do +# Also ignore created, as not present in the parent commit +for f in $(git show --diff-filter=M --pretty="" --name-only "${HEAD}" | grep -E "\.yaml$"); do yamllint $f | tee -a $tmpfile_o done @@ -38,7 +39,7 @@ incumbent_w=$(grep -i -c " warning " $tmpfile_o) pr "Checking the tree with the patch" git checkout -q $HEAD -for f in $(git show --diff-filter=AM --pretty="" --name-only HEAD | grep -E "\.yaml$"); do +for f in $(git show --diff-filter=AM --pretty="" --name-only "${HEAD}" | grep -E "\.yaml$"); do yamllint $f | tee -a $tmpfile_n done