Skip to content

Commit b9788b1

Browse files
authored
Fix the mechanism we use to detect symlinks (#98)
1 parent aededce commit b9788b1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

check-style.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@ case $1 in
4242
esac
4343

4444
# Filter out symlinks from `affected_files`. We'll check the real files.
45-
affected_files=$(echo "$affected_files" | xargs -r -n1 file | grep -v 'symbolic link' | cut -d: -f1 | tr '\n' ' ')
45+
# Use bash test operators instead of the 'file' command to avoid issues with
46+
# filenames containing special characters (colons, commas, etc).
47+
filtered_files=""
48+
for f in $affected_files; do
49+
if [ ! -L "$f" ]; then
50+
filtered_files="$filtered_files $f"
51+
fi
52+
done
53+
affected_files=$(echo "$filtered_files" | xargs -r)
4654

4755
# Unset variable would be a sign of programmer error. We are not using '-e' in
4856
# this script as we'd like to handle these cases ourselves where relevant, i.e.,

0 commit comments

Comments
 (0)