Created
June 10, 2021 05:19
-
-
Save jconst/eb0177729dc7c6cfc4d15fad84e61649 to your computer and use it in GitHub Desktop.
merge-wrapper for UnityYAMLMerge
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
#!/bin/bash | |
# Wrapper script for git mergetool | |
# This requires the .gitconfig file to have: | |
# - mergetool entry for "unityyamlmerge"; | |
# - mergetool entry for "p4mergetool"; | |
# These merge tool entries must both specify the | |
# cmd field. The command to call this script: | |
# [mergetool "merge_wrapper"] | |
# cmd = $HOME/merge-wrapper \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\" | |
# Locate this script in your $HOME | |
BASE=$1 | |
LOCAL=$2 | |
REMOTE=$3 | |
MERGED=$4 | |
UNITY_EXT="\.unity" | |
if echo "$BASE" | grep -q "$UNITY_EXT"; then | |
echo "Using merge tool for unity file"; | |
CMD=$(git config mergetool.unityyamlmerge.cmd) | |
eval $CMD | |
else | |
#checking for additional special merge tool cases | |
#Finally, the default case: | |
echo "Using default merge tool"; | |
CMD=$(git config mergetool.p4mergetool.cmd) | |
eval $CMD | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment