Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Is UnityYAMLMerge actually being used? #943

Description

@Piotr-B

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. A mergetool 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 files
*.meta -text merge=unityamlmerge diff
*.unity -text merge=unityamlmerge diff
*.asset -text merge=unityamlmerge diff
*.prefab -text merge=unityamlmerge diff

GitClient.SetConfig("merge.unityyamlmerge.cmd", yamlMergeCommand, GitConfigSource.Local).Catch(e => {
Logger.Error(e, "Error setting merge.unityyamlmerge.cmd");
return true;
}).RunSynchronously();
GitClient.SetConfig("merge.unityyamlmerge.trustExitCode", "false", GitConfigSource.Local).Catch(e => {
Logger.Error(e, "Error setting merge.unityyamlmerge.trustExitCode");
return true;
}).RunSynchronously();

Activity

  1. StanleyGoldman commented on Oct 19, 2018

    @StanleyGoldman
    Contributor

    Hey @Piotr-B. Honestly, thanks for your analysis.
    Obviously we intend for UnityYamlMerge to get configured correctly, but yea, we have some bugs.

    I will try next week to investigate and resolve the issues your raised.
    Maybe, if you have, you can help me review/test.

  2. fabiopolimeni commented on Nov 22, 2018

    @fabiopolimeni

    Hi guys, I would like to start using GitHub for Unity for our next project, and this bug sounds pretty important to me. At what point you honestly are with this?

    Thanks,
    Fabio

  3. StanleyGoldman commented on Nov 26, 2018

    @StanleyGoldman
    Contributor

    Hey @fabiopolimeni thanks for checking our stuff out.
    Sorry, we are a bit behind with things. Shana and I have a few different projects we maintain.
    We are planning a release in December and this bug should be fixed in that release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions