-
Notifications
You must be signed in to change notification settings - Fork 89
Add check for the presence of conflict into linters #912
Add check for the presence of conflict into linters #912
Conversation
Codecov Report
@@ Coverage Diff @@
## master #912 +/- ##
==========================================
- Coverage 63.84% 62.50% -1.35%
==========================================
Files 25 20 -5
Lines 1751 1040 -711
==========================================
- Hits 1118 650 -468
+ Misses 461 300 -161
+ Partials 172 90 -82 Continue to review full report at Codecov.
|
bb5d0b3
to
87885f1
Compare
hack/check-conflicts.sh
Outdated
|
||
echo -ne "\n\tChecking staged files... " | ||
if [ $(git diff --cached --name-only | wc -l) != "0" ]; then | ||
results=$(git diff --cached --name-only | grep -v "vendor/" | xargs grep -PiIrnH '<<<<''<<<|>>>''>>>>|===''====' || true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can move even check logic into check_result
(or whatever we call it later on) function. Something along these lines:
check_merge_conflicts() {
for f in "$@"; do
grep -PiIrnH '<<<<''<<<|>>>''>>>>|===''====' "$f" && echo "$f" && break
done || found=1
if [ -z "$found" ]; then
echo PASS
else
echo FAIL
exit 1
fi
}
check_merge_conflicts $(git diff --cached --name-only | grep -v "vendor/")
check_merge_conflicts $(git ls-tree --full-tree -r HEAD --name-only | grep -v "vendor/")
Signed-off-by: Pavel Macík <[email protected]>
87885f1
to
5a7a037
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: pedjak The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Motivation
Currently it is possible to accidently commit conflict notes (such as
<<<<<<< HEAD
) in source files without actually noticing it.Changes
This PR:
Testing
make lint-conflicts