Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Unity Hub, Smart Merge and Gitconfig portability

Discussion in '2019.2 Beta' started by bitinn, Mar 24, 2019.

  1. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    In the old days, we have one Unity install on the machine, and our gitconfig for UnityYAMLMerge is as simple as following:

    Code (CSharp):
    1.  
    2. [merge]
    3. tool = unityyamlmerge
    4.  
    5. [mergetool "unityyamlmerge"]
    6. trustExitCode = false
    7. cmd = '/Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge' merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
    8.  
    Assuming all your engineers are on macOS, there won't be any issue.

    Nowadays Unity is installed with Unity Hub, which means the UnityYAMLMerge path kept changing with each release. Such that gitconfig has to keep up, unless given a way to detect Unity install path.

    And of course you run into problems when one user is using Unity Hub and the other is not.

    I don't know the best way to tackle this, but my workaround was to copy UnityYAMLMerge into a custom directory and refers to it. Doing so isn't cross platform neither, and worse, UnityYAMLMerge program doesn't output version information, so it's impossible for me to know when I need to update it next.

    To workaround this, GitHub for Unity has do away with a static gitconfig all together, and make it a dynamic configuration. I doubt everyone has the luxury / incentive of using GitHub tool. So a proper solution is needed for other git users.

    There are a few possible solutions:

    - Unity Hub can distribute this tool separately, so the path is fixed.
    - Unity could update documentation to guide people to setup gitconfig in another way.
    - Unity could integrate this tool with popular code editor as extensions.

    I don't know how other teams solve this issue, so suggestions welcomed.

    (Personally, I seldom run into merge conflict, mostly because I am usually the sole programmer on a project; and in my case I didn't notice the path was wrong in my gitconfig for over 6 months...)
     
  2. Miika-Virtanen

    Miika-Virtanen

    Joined:
    Oct 30, 2014
    Posts:
    1
    One possible solution is to create a trampoline application which parses the Unity Hub defaultEditor.json configuration to find the current preferred editor and forwards the call there. You can then keep this tool in a static location and it doesn't need to get updated unless Unity changes where they store the information about current preferred editor.