File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -79,9 +79,13 @@ if [ $? -ne 0 ]; then
79
79
DIFF=diff
80
80
fi
81
81
82
- SHA1SUM=$( which sha1sum)
83
- if [ $? -ne 0 ]; then
84
- SHA1SUM=shasum
82
+ if command -v sha1sum > /dev/null 2>&1 ; then
83
+ SHA1SUM=" sha1sum"
84
+ elif command -v shasum > /dev/null 2>&1 ; then
85
+ SHA1SUM=" shasum"
86
+ else
87
+ echo " [!] sha1sum or shasum not installed." >&2
88
+ exit 1
85
89
fi
86
90
87
91
FILES=$( git diff --cached --name-only --diff-filter=ACMR | grep -E " \.(c|cpp|h)$" )
@@ -116,7 +120,7 @@ if [ ! -z "${FILES[*]}" ]; then
116
120
echo " ${FILES[*]} "
117
121
fi
118
122
119
- $SHA1SUM -c scripts/checksums > /dev/null
123
+ $SHA1SUM -c scripts/checksums 2> /dev/null > /dev/null
120
124
if [ $? -ne 0 ]; then
121
125
echo " [!] You are not allowed to change the header file queue.h or list.h" >&2
122
126
exit 1
You can’t perform that action at this time.
0 commit comments