Merge remote-tracking branch 'origin/sprint-37/copy'
Resolved 8 conflicts in wiki/corporations/ between server #860 tag updates and copy #861 three-layer authoring. Resolution: union of server's commodity-tag additions + D-175 decision_refs, plus copy's cross_refs populated entries.
This commit is contained in:
+22
-4
@@ -9,14 +9,27 @@ ERRORS=0
|
||||
echo "pre-push: running lint checks..."
|
||||
|
||||
# --- Detect which directories have changes vs remote ---
|
||||
# Prefer origin/<branch> as the baseline (what the remote already has),
|
||||
# but fall back to origin/main for first-push of a new branch — otherwise
|
||||
# every check runs against nothing and the hook treats the whole repo as
|
||||
# changed, spending tens of seconds on linters and JSON validation that
|
||||
# have no diff to cover (e.g. pushing a wiki-only branch rebuilds GDScript
|
||||
# and runs clippy + ruff + validates all 2762 JSON files).
|
||||
BRANCH=$(git branch --show-current)
|
||||
REMOTE_REF="origin/$BRANCH"
|
||||
if git rev-parse --verify "$REMOTE_REF" >/dev/null 2>&1; then
|
||||
if git rev-parse --verify "origin/$BRANCH" >/dev/null 2>&1; then
|
||||
REMOTE_REF="origin/$BRANCH"
|
||||
elif git rev-parse --verify "origin/main" >/dev/null 2>&1; then
|
||||
REMOTE_REF="origin/main"
|
||||
else
|
||||
REMOTE_REF=""
|
||||
fi
|
||||
|
||||
if [ -n "$REMOTE_REF" ]; then
|
||||
CLIENT_CHANGED=$(git diff --name-only "$REMOTE_REF"..HEAD -- client/ 2>/dev/null | wc -l)
|
||||
SERVER_CHANGED=$(git diff --name-only "$REMOTE_REF"..HEAD -- server/ 2>/dev/null | wc -l)
|
||||
TOOLING_CHANGED=$(git diff --name-only "$REMOTE_REF"..HEAD -- tooling/ pyproject.toml 2>/dev/null | wc -l)
|
||||
else
|
||||
# New branch or no remote ref — fall through to directory checks
|
||||
# No remote at all (e.g. fresh clone before first fetch) — be safe, run everything
|
||||
CLIENT_CHANGED=1
|
||||
SERVER_CHANGED=1
|
||||
TOOLING_CHANGED=1
|
||||
@@ -114,7 +127,12 @@ else
|
||||
fi
|
||||
|
||||
# --- JSON syntax validation ---
|
||||
if git rev-parse --verify "$REMOTE_REF" >/dev/null 2>&1; then
|
||||
# Use the same REMOTE_REF the directory-change detection above settled on
|
||||
# (origin/<branch> preferred, origin/main fallback). Without this, a first
|
||||
# push of a new branch falls through to "validate every JSON in the repo,"
|
||||
# which on this repo means 2762 Python parses — tens of seconds of churn
|
||||
# for a push that might not have touched any JSON at all.
|
||||
if [ -n "$REMOTE_REF" ]; then
|
||||
JSON_FILES=$(git diff --name-only "$REMOTE_REF"..HEAD -- '*.json' 2>/dev/null || true)
|
||||
else
|
||||
JSON_FILES=$(git ls-files '*.json')
|
||||
|
||||
Reference in New Issue
Block a user