From 5dd5c760d7ffe6acc2fd75b436f72199b57129bf Mon Sep 17 00:00:00 2001 From: megaproxy Date: Tue, 14 Jul 2026 21:10:32 +0100 Subject: [PATCH] scripts: warn when incoming commits touch Unity scene/asset files --- scripts/session-git-check.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/session-git-check.sh b/scripts/session-git-check.sh index 61b1ccf..61cbab8 100644 --- a/scripts/session-git-check.sh +++ b/scripts/session-git-check.sh @@ -20,6 +20,14 @@ if git rev-parse --git-dir >/dev/null 2>&1; then if [ -n "$incoming" ]; then add "INCOMING commits on $upstream (you are behind — pull to get them):" while IFS= read -r l; do add " $l"; done <<< "$incoming" + # Flag incoming edits to Unity scene/prefab/asset files — risky to pull + # while the Editor is open (it may overwrite them or hold a stale copy). + scenefiles=$(git diff --name-only "HEAD..$upstream" 2>/dev/null | grep -Ei '\.(unity|prefab|asset|mat|controller)$') + if [ -n "$scenefiles" ]; then + add " *** WARNING: incoming commits change Unity scene/asset files:" + while IFS= read -r f; do add " $f"; done <<< "$scenefiles" + add " *** CLOSE or save the Unity Editor before pulling to avoid clobbering scene state." + fi else add "Up to date with $upstream (no incoming commits)." fi