From 9209a67be3af9848e79a20ead58eeed3d3f34b33 Mon Sep 17 00:00:00 2001 From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com> Date: Thu, 2 Apr 2026 10:06:19 -0700 Subject: [PATCH 1/2] feat: add pre-commit check for merge conflict markers --- .husky/pre-commit | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.husky/pre-commit b/.husky/pre-commit index 1a2485251c..49b94b90b6 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1,31 @@ #!/bin/sh +. "$(dirname "$0")/_/husky.sh" + + +# Check for merge conflict markers +# This hook prevents commits that contain unresolved merge conflicts. +# It checks the staged changes for common conflict markers +# (e.g., <<<<<<<, =======, >>>>>>>) and blocks the commit if any are found. + +# This file will always fail since it contains the conflict markers pattern, +# We will still check this file for conflict markers to prevent committing +# unresolved conflicts. + +# In order to intentionallyupdate this file, create a commit with only this +# file and skip the pre-commit hook +# Usage: +# - Run with env var: SKIP_CONFLICT_CHECK=1 git commit +if [ "$SKIP_CONFLICT_CHECK" != "1" ]; then + conflicts=$(git diff --cached --name-only | xargs grep -H -n -E "<{7} HEAD|={7}|>{7} " 2>/dev/null) + if [ ! -z "$conflicts" ]; then + echo "Error: Merge conflict markers found in staged files." + echo "\nConflicts found:" + echo "$conflicts" | while IFS= read -r line; do + echo " → $(echo "$line" | sed 's/\([0-9]\):\([<>=]\)/\1 \2/')" + done + echo "\nPlease resolve all merge conflicts before committing." + exit 1 + fi +fi + +exit 0 From 9612664dcd071afa56d2bec53fb2e6b024faef80 Mon Sep 17 00:00:00 2001 From: Scott Williams <5209283+scott-williams-az@users.noreply.github.com> Date: Thu, 2 Apr 2026 11:24:43 -0700 Subject: [PATCH 2/2] fix: remove accidental line, add skip on CI --- .husky/pre-commit | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 49b94b90b6..16e9613f62 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,5 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" - +[ -n "$CI" ] && exit 0 # Check for merge conflict markers # This hook prevents commits that contain unresolved merge conflicts.