File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,16 @@ if echo "$workspace" | grep -q "[一-龥]"; then
82
82
throw " The workspace path '$workspace ' contains non-ASCII characters."
83
83
fi
84
84
85
+ # Check for merge conflict markers in staged changes.
86
+ # Assemble the conflict marker regex without embedding it directly.
87
+ CONFLICT_MARKERS=$( printf ' %s|%s|%s' " <<<<<<<" " =======" " >>>>>>>" )
88
+ # Get staged files that contain conflict markers, but exclude hook files.
89
+ CONFLICT_FILES=$( git diff --cached --name-only -G " ${CONFLICT_MARKERS} " | \
90
+ grep -vE ' (^|/)\.git/hooks/|(^|/)(pre-commit|commit-msg|prepare-commit-msg|pre-push)\.hook$' )
91
+ if [ -n " ${CONFLICT_FILES} " ]; then
92
+ throw " Conflict markers are still present in the following files:\n%s" ${CONFLICT_FILES}
93
+ fi
94
+
85
95
CLANG_FORMAT=$( which clang-format)
86
96
if [ $? -ne 0 ]; then
87
97
throw " clang-format not installed. Unable to check source file format policy."
You can’t perform that action at this time.
0 commit comments