File tree Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Original file line number Diff line number Diff line change 66# pre-commit uses the "identify" pure python library to detect binary files.
77# ###############################################################################
88
9- if [ $# -gt 0 ]; then
10- for filename in " ${@ } " ; do
11- echo " [ERROR] ${filename} appears to be a binary file"
12- done
13- exit 1
9+ binaries=0
10+
11+ if command -v git-lfs > /dev/null 2>&1 ; then
12+ if [ $# -gt 0 ]; then
13+ for filename in " ${@ } " ; do
14+ list=$( git lfs ls-files --include " ${filename} " )
15+ if [ -z " ${list} " ]; then
16+ echo " [ERROR] ${filename} appears to be a binary file"
17+ binaries=$(( binaries + 1 ))
18+ fi
19+ done
20+
21+ if [ ${binaries} -gt 0 ]; then
22+ exit 1
23+ fi
24+ fi
25+
26+ else
27+ if [ $# -gt 0 ]; then
28+ for filename in " ${@ } " ; do
29+ echo " [ERROR] ${filename} appears to be a binary file"
30+ done
31+ exit 1
32+ fi
1433fi
You can’t perform that action at this time.
0 commit comments