Skip to content

Commit 9cb157a

Browse files
committed
prepare-commit.sh: remove executable bit from source files and exit successfully if nothing modified
1 parent 9a2327c commit 9cb157a

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

scripts/prepare-commit.sh

+14-9
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fi
4848

4949
if [ -z "$MODIFIED" ]; then
5050
echo nothing was modified
51-
exit 1
51+
exit 0
5252
fi
5353

5454
# save original changes
@@ -67,12 +67,15 @@ ASTYLEDIFF=astyle.$REV.diff
6767
for f in $MODIFIED; do
6868
case "$f" in
6969
src/core/spatialite/*|src/core/gps/qextserialport/*|src/plugins/dxf2shp_converter/dxflib/src/*|src/plugins/globe/osgEarthQt/*|src/plugins/globe/osgEarthUtil/*)
70-
echo $f skipped
70+
echo $f skipped
7171
continue
7272
;;
7373

74-
*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H)
75-
;;
74+
*.cpp|*.c|*.h|*.cxx|*.hxx|*.c++|*.h++|*.cc|*.hh|*.C|*.H)
75+
if [ -x "$f" ]; then
76+
chmod a-x "$f"
77+
fi
78+
;;
7679

7780
*.py)
7881
perl -i.prepare -pe "s/[\t ]+$//;" $f
@@ -83,12 +86,12 @@ for f in $MODIFIED; do
8386
continue
8487
;;
8588

86-
*)
87-
continue
88-
;;
89-
esac
89+
*)
90+
continue
91+
;;
92+
esac
9093

91-
m=$f.$REV.prepare
94+
m=$f.$REV.prepare
9295

9396
cp $f $m
9497
astyle.sh $f
@@ -111,3 +114,5 @@ else
111114
fi
112115

113116
exit 0
117+
118+
# vim: set ts=8 noexpandtab :

0 commit comments

Comments
 (0)