File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ function test_file {
4+ file=" ${1} "
5+
6+ if [ ! -f " ${file} " ] ; then
7+ return
8+ fi
9+
10+ echo " Running unresolved merge lint..."
11+ # Set -e before and +e after for _required_ linters (i.e.: that will prevent
12+ # commit, e.g.: syntax linters).
13+ # Set +e before and -e after for _optional_ linters (i.e.: that will only
14+ # output messages upon commit, e.g.: style linters).
15+ set -e
16+ { grep -i -E ' ^(<<<<<<<|=======|>>>>>>>)' $file && test $? = 1; }
17+ set +e
18+ }
19+
20+ case " ${1} " in
21+ --about )
22+ echo " Check for fishbones (<<<<<<<, =======, >>>>>>>) left by unresolved merges."
23+ ;;
24+
25+ * )
26+ for file in $( git diff-index --cached --name-only HEAD | grep -v -E ' \.(gif|gz|ico|jpeg|jpg|png|phar|exe|svgz|tff)' ) ; do
27+ test_file " ${file} "
28+ done
29+ ;;
30+ esac
You can’t perform that action at this time.
0 commit comments