Files
athens/scripts/check_conflicts.sh
Kenshi Kamata 667b9fdf65 Fix typo (#1358)
* fix duplicated 'the'

* fix typo found by misspell
2019-08-27 10:55:09 -07:00

23 lines
924 B
Bash
Executable File

#!/bin/bash
# check_conflicts.sh
# this script checks for changes to files OTHER THAN *.go, go.mod and go.sum
# ensuring no git merge conflict artifacts are being committed.
# i.e. <<<<<<<HEAD or ======= or >>>>>>>branch-name
#
# this is intended to be used in your CI tests
#
# the script will exit with code 1 on finding any matches, causing the
# CI build to fail. Merge conflict artifacts must be removed before continuing.
git remote set-branches --add origin master && git fetch
COUNT=$(git diff origin/master -- . ':!*.go' ':!go.mod' ':!go.sum' | grep -Ec "^\+[<>=]{7}\w{0,}")
if (($COUNT > 0));then
echo "************************************************************"
echo "The following files contained merge conflict artifacts:\n"
exec git diff --name-only -G'^[<>=]{7}\w?' origin/master -- . ':!*.go' ':!go.mod' ':!go.sum'
echo "************************************************************"
exit 1
fi