#!/usr/bin/env bash # Resolve plan/ conflicts left by a merge or rebase. # # plan/README.md's tables are generated, so a textual conflict in them carries # no information: regenerating is the resolution. plan/order.txt union-merges # via .gitattributes and needs nothing here, but is checked so a duplicated id # is caught rather than silently doubling a row. set -euo pipefail cd "$(dirname "$0")/.." if grep -qE '^(<<<<<<<|>>>>>>>)' plan/README.md 2>/dev/null; then # Take either side wholesale; the regeneration below is what makes it right. git checkout --ours plan/README.md 2>/dev/null || true fi python3 scripts/gen-plan-readme.py python3 scripts/check-plan.py python3 scripts/gen-plan-readme.py --check dupes=$(grep -vE '^\s*(#|$)' plan/order.txt | sort | uniq -d) if [ -n "$dupes" ]; then echo "plan/order.txt has duplicate ids after the union merge:" >&2 echo "$dupes" >&2 echo "remove one of each, then rerun." >&2 exit 1 fi git add plan/README.md plan/order.txt echo "plan/ resolved: README regenerated, order.txt checked."