git source files with rw permissions

From: Joe Perches
Date: Thu Apr 05 2018 - 20:53:54 EST


Some .c source files have r.x permissions (0755) that
should be updated.

A trivial script on a clean git tree like:

$ git ls-files -- "*.[chsS]" | \
xargs ls -la | \
grep -P "^[^l](?:.{2,2}x|.{5,5}x|.{8,8}x)" | \
awk '{print $9}'

today shows:

drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
drivers/net/ethernet/cadence/macb_ptp.c

It would be good to update those via some script like:

$ git ls-files -- "*.[chsS]" | \
xargs ls -la | \
grep -P
"^[^l](?:.{2,2}x|.{5,5}x|.{8,8}x)" | \
awk '{print $9}' | \
xargs
chmod 644
tmpfile=$(mktemp)
echo "treewide: chmod executable source files
to 0644" > $tmpfile
git commit -s -a -F $tmpfile
rm -f $tmpfile