scripts: warn when incoming commits touch Unity scene/asset files

This commit is contained in:
megaproxy 2026-07-14 21:10:32 +01:00
parent 8e4a19b7d8
commit 5dd5c760d7

View file

@ -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