make validate-local runs this script on every PR to catch leftover merge conflict markers.
It never catches any.
Line 9 tests grep's output instead of its exit status:
if [ $(grep -r "^\(<<<<<<<\|>>>>>>>\|^=======$\)" $f) ]; then
Git writes markers with a label (<<<<<<< HEAD), so the unquoted substitution hands [ two
or more arguments. [ fails with "too many arguments" and exits non-zero, so the if is
false and the file is never flagged.
Reproduce:
T=$(mktemp -d); cd "$T"; git init -q .; git config user.email t@t; git config user.name t
printf 'a\n<<<<<<< HEAD\nmine\n=======\ntheirs\n>>>>>>> feature\n' > conflicted.go
git add -A; git commit -qm t
bash /path/to/skopeo/hack/validate-git-marks.sh; echo "rc=$?"
Got:
validate-git-marks.sh: line 9: [: too many arguments
Congratulations! There is no conflict.
rc=0
Expected: names conflicted.go, exits 1.
Not macOS-specific — the failure is in bash's [, not grep.
make validate-localruns this script on every PR to catch leftover merge conflict markers.It never catches any.
Line 9 tests grep's output instead of its exit status:
Git writes markers with a label (
<<<<<<< HEAD), so the unquoted substitution hands[twoor more arguments.
[fails with "too many arguments" and exits non-zero, so theifisfalse and the file is never flagged.
Reproduce:
Got:
Expected: names
conflicted.go, exits 1.Not macOS-specific — the failure is in bash's
[, not grep.