Created
October 12, 2020 09:25
-
-
Save RamType0/11318a6e5e32e4adaf5a24f8d22f9f1d to your computer and use it in GitHub Desktop.
Unityのインストール場所に関係なくUnityYAMLMergeをGitで使うためのgitconfigのセットアップを行うPowerShellスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Param([switch][bool]$system,[switch][bool]$global,[switch][bool]$local) | |
| # --systemでシステム、--globalでユーザー、--localでリポジトリ内を対象として設定を行う。優先順位はlocal>global>system | |
| function SetGitConfig ([ValidateSet('--system','--global','--local')][string]$scope) | |
| { | |
| git config $scope merge.tool unityyamlmerge | |
| git config $scope mergetool.unityyamlmerge.trustExitCode true | |
| git config $scope mergetool.unityyamlmerge.cmd "powershell \`"&(Get-ItemPropertyValue `'HKCU:\Software\Unity Technologies\Installer\Unity' -Name 'Location x64' | Join-Path -ChildPath 'Editor\Data\Tools\UnityYAMLMerge.exe') merge -p `$BASE `$REMOTE `$LOCAL `$MERGED\`"" | |
| } | |
| if(-not ($system -or $global -or $local)){ | |
| throw "At least one option required." | |
| } | |
| if ($system) { | |
| Write-Output 'Setting up system configuration...' | |
| SetGitConfig('--system') | |
| } | |
| if($global){ | |
| Write-Output 'Setting up global configuration...' | |
| SetGitConfig('--global') | |
| } | |
| if($local){ | |
| Write-Output 'Setting up local configuration...' | |
| SetGitConfig('--local') | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment