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