Is UnityYAMLMerge actually being used? #943
Description
Description
While investigating using this plugin for our next project I noticed that the UnityYAMLMerge tool seems to get configured for use but never actually gets launched.
When creating a project with the plugin the following configuration options get set:
.gitattributes:
# Unity files
*.meta -text merge=unityamlmerge diff
*.unity -text merge=unityamlmerge diff
*.asset -text merge=unityamlmerge diff
*.prefab -text merge=unityamlmerge diff
.git/config:
[merge "unityyamlmerge"]
cmd = 'C:\\Program Files\\Unity 2018.1.1f1\\Editor\\Data\\Tools\\UnityYAMLMerge.exe' merge -p $BASE $REMOTE $LOCAL $MERGED
trustExitCode = false
This looks well and good but:
- Attributes file misspells the tool as "unityamlmerge" (note the missing "y").
- Config file doesn't misspell the tool name.
- Even if the names did match the tool still wouldn't run because the
merge
attribute looks for a custom low-level merge driver in the config file in the following format:
[merge "mergeDriverName"]
name = Human-readable name
driver = mergeDriverExecutable %O %A %B %L %P
recursive = binary
- The config file as is uses the custom merge driver header
[merge "unityyamlmerge"]
but external merge tool fields:cmd =
trustExitCode =
. These are different things but appear to be mixed here. Amergetool
section is supposed to look like this:
[mergetool "extMerge"]
cmd = extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
trustExitCode = false
But for that to work it also requires this entry, which is missing:
[merge]
tool = extMerge
And I think that would launch the tool for all file types not just the select ones.
Disclaimer:
I'm not very proficient in git so I might be missing something here but this is what it looks like to me after investigating the code and docs.
I'm using GitHub for Unity 1.1.0 and Unity 2018.1.1f1.
References
https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_external_merge_tools
https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
https://git-scm.com/docs/git-config#git-config-mergetool
https://docs.unity3d.com/Manual/SmartMerge.html
Unity/src/GitHub.Api/Resources/.gitattributes
Lines 3 to 7 in 1c53148
Unity/src/GitHub.Api/Application/ApplicationManagerBase.cs
Lines 291 to 299 in 1c53148