#!/usr/bin/env sh # Configure this repo for Git LFS file locking with the WAY auto-lock plugin. # Run once per clone, from anywhere inside the repo: # sh setup-locks.sh [soft|hard] [forgejo-username] set -e MODE="${1:-soft}" USERNAME="${2:-}" cd "$(git rev-parse --show-toplevel)" git lfs install if [ "$MODE" = "hard" ]; then git config lfs.setlockablereadonly true else git config lfs.setlockablereadonly false fi echo "lfs.setlockablereadonly = $(git config --get lfs.setlockablereadonly)" # UnityYAMLMerge smart-merge driver (the .gitattributes already references merge=unityyamlmerge). # Adjust the path to your Unity install if 'UnityYAMLMerge' is not on PATH. git config merge.unityyamlmerge.name "Unity SmartMerge" git config merge.unityyamlmerge.driver 'UnityYAMLMerge merge -p %O %B %A %A' git config merge.unityyamlmerge.recursive binary # 'git sync' = push current branch + release my finished locks (mirrors the plugin's button). chmod +x "$(git rev-parse --show-toplevel)/.githooks/git-sync.sh" 2>/dev/null || true git config alias.sync '!sh "$(git rev-parse --show-toplevel)/.githooks/git-sync.sh"' if [ -n "$USERNAME" ]; then git config wayLocks.username "$USERNAME" echo "wayLocks.username = $USERNAME" else echo "Set your Forgejo username: git config wayLocks.username " fi cat <<'EOF' Done (git side). In Unity: 1. Package Manager > + > Add package from git URL: https://github.com/wayexperience/unity-git-locks.git#v1.3.0 2. Project Settings > Editor: Asset Serialization = Force Text, Version Control = Visible Meta Files. 3. Preferences > Git Locks: set your username (same as wayLocks.username). The lock policy is already committed in ProjectSettings/GitLocksConfig.json. EOF