diff --git a/dev/check-files.sh b/dev/check-files.sh
index 0d4279350112df8b6ec776c8661e70a502068df3..5bc87e486f9f75c489d21cf75cf8bef12d43bf57 100755
--- a/dev/check-files.sh
+++ b/dev/check-files.sh
@@ -88,8 +88,8 @@ else
     rm -f "$TMP_STAGED" "$TMP_UNSTAGED" "$TMP_INPUT" "$TMP_INTER"
   }
   trap cleanup exit
-  git diff --diff-filter ACMR --name-only $DIFF_ARG | sort > "$TMP_STAGED"
-  git diff --diff-filter DMR --name-only | sort > "$TMP_UNSTAGED"
+  git diff -z --diff-filter ACMR --name-only $DIFF_ARG | sort -z > "$TMP_STAGED"
+  git diff -z --diff-filter DMR --name-only | sort -z > "$TMP_UNSTAGED"
 
   if [ ! -s "$TMP_STAGED" ];
   then