-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup-mergesmart.sh
More file actions
executable file
·34 lines (26 loc) · 1.03 KB
/
setup-mergesmart.sh
File metadata and controls
executable file
·34 lines (26 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
set -euo pipefail
# Try common Unity Hub locations
CANDIDATES=(
"/Applications/Unity/Hub/Editor" # macOS
"$HOME/Unity/Hub/Editor" # Linux (common)
"$HOME/Applications/Unity/Hub/Editor" # sometimes
)
FOUND=""
for base in "${CANDIDATES[@]}"; do
if [[ -d "$base" ]]; then
# Look for UnityYAMLMerge inside any installed version
FOUND="$(find "$base" -maxdepth 5 -type f -name UnityYAMLMerge 2>/dev/null | head -n 1 || true)"
[[ -n "$FOUND" ]] && break
FOUND="$(find "$base" -maxdepth 8 -type f -iname "*yaml*merge*" 2>/dev/null | head -n 1 || true)"
[[ -n "$FOUND" ]] && break
fi
done
if [[ -z "$FOUND" ]]; then
echo "Could not find UnityYAMLMerge. Install Unity via Unity Hub or locate the binary manually."
exit 1
fi
echo "Found UnityYAMLMerge at: $FOUND"
git config merge.unityyamlmerge.name "Unity SmartMerge (UnityYAMLMerge)"
git config merge.unityyamlmerge.driver "\"$FOUND\" merge -p %O %B %A %A"
echo "Configured Smart Merge for this repo."