mirror of
https://github.com/gomods/athens
synced 2026-02-03 11:00:32 +00:00
No conflicts (#569)
* add script and step to verify stage of makefile * this commit should fail the build * build should now pass * fix typo in excludes for grep * better output on failure also removes tilde from initial regex, git does not use tilde in diffs adds output of filenames with detected regex on failure
This commit is contained in:
committed by
Aaron Schlesinger
parent
5c3af51a1d
commit
37f0687761
@@ -21,6 +21,7 @@ verify:
|
||||
./scripts/check_gofmt.sh
|
||||
./scripts/check_golint.sh
|
||||
./scripts/check_deps.sh
|
||||
./scripts/check_conflicts.sh
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/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 commited.
|
||||
# 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
|
||||
Reference in New Issue
Block a user