[ci] Fix check-generated script with untracked files

git diff doesn't report untracked files, so isn't really the right
thing to use here. Instead, use "git status" with the --porcelain
flag, which prints something iff the tree has untracked/uncommitted
changes.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
diff --git a/ci/scripts/check-generated.sh b/ci/scripts/check-generated.sh
index c45bff0..1731069 100755
--- a/ci/scripts/check-generated.sh
+++ b/ci/scripts/check-generated.sh
@@ -3,37 +3,45 @@
 # Licensed under the Apache License, Version 2.0, see LICENSE for details.
 # SPDX-License-Identifier: Apache-2.0
 
+# Returns 0 if there are no changes or untracked files, 1 otherwise
+is_clean() {
+    local output
+    output="$(git status --porcelain)" || return 1
+    test -z "$output" && return 0
+    return 1
+}
+
 # Check generated files are up to date
 
-make -k -C hw regs && git diff --exit-code
+make -k -C hw regs && is_clean
 if [[ $? != 0 ]]; then
   echo -n "##vso[task.logissue type=error]"
   echo "Register headers not up-to-date. Regenerate them with 'make -C hw regs'."
   exit 1
 fi
 
-make -k -C hw top && git diff --exit-code
+make -k -C hw top && is_clean
 if [[ $? != 0 ]]; then
   echo -n "##vso[task.logissue type=error]"
   echo "Autogenerated tops not up-to-date. Regenerate with 'make -C hw top'."
   exit 1
 fi
 
-make -k -C hw otp-mmap && git diff --exit-code
+make -k -C hw otp-mmap && is_clean
 if [[ $? != 0 ]]; then
   echo -n "##vso[task.logissue type=error]"
   echo "Autogenerated OTP memory map files not up-to-date. Regenerate with 'make -C hw otp-mmap'."
   exit 1
 fi
 
-make -k -C hw lc-state-enc && git diff --exit-code
+make -k -C hw lc-state-enc && is_clean
 if [[ $? != 0 ]]; then
   echo -n "##vso[task.logissue type=error]"
   echo "Autogenerated LC state not up-to-date. Regenerate with 'make -C hw lc-state-enc'."
   exit 1
 fi
 
-hw/ip/flash_ctrl/util/flash_ctrl_gen.py && git diff --exit-code
+hw/ip/flash_ctrl/util/flash_ctrl_gen.py && is_clean
 if [[ $? != 0 ]]; then
   echo -n "##vso[task.logissue type=error]"
   echo "Autogenerated flash_ctrl code not up-to-date."
@@ -41,7 +49,7 @@
   exit 1
 fi
 
-util/design/secded_gen.py --no_fpv && git diff --exit-code
+util/design/secded_gen.py --no_fpv && is_clean
 if [[ $? != 0 ]]; then
   echo -n "##vso[task.logissue type=error]"
   echo "Autogenerated secded primitive code not up-to-date."