Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug unityYAMLMerge messing up merged code by adding line breaks

Discussion in 'Unity Version Control' started by svenneve, Aug 17, 2023.

  1. svenneve

    svenneve

    Joined:
    May 14, 2013
    Posts:
    61
    For some reason, unityYAMLmerge in PlasticSCM when used with prefabs adds line breaks to pretty much all existing lines (even lines that needn't be merged)

    This can't be by design can it?, as this makes double checking merges completely impossible.

    Am I doing something wrong? Is this a bug?

    See attached screenshot.

    Unity 2021.3.20f with PlasticSCM (or whatever the f it's now called) 11.0.16.8060
     

    Attached Files:

  2. Wolfram

    Wolfram

    Joined:
    Feb 16, 2010
    Posts:
    253
    Yeah, it's an old bug of UnityYAMLMerge.exe, and so far they haven't bothered to fix that :-/
    See footnote here: https://uninomicon.com/yamlmerge
    So PlasticSCM is not at fault, but since it internally calls UnityYAMLMerge, this problem becomes visible.

    There is a relatively new (>=2020.x?) Editor setting SerializeInlineMappingsOnOneLine, which appears to be ON by default - but UnityYAMLMerge completely ignores this, and always creates output emulated with this setting OFF.

    YAML_Inline_Linebreaks.png

    https://docs.unity3d.com/2020.1/Doc...ettings-serializeInlineMappingsOnOneLine.html

    Until Unity fixes this, your best bet will probably be to DISABLE this flag, and force-reimport all scenes+prefabs once (untested - will probably not help directly, as a re-import generally doesn't modify the Assets, only the metadada).
    Another method would be to disallow PlasticSCM from calling UnityYAMLMerge, by configuring its MergeTools for the entry ".prefab;.unity", so it uses the regular diff tool instead - at the cost of possibly slightly less intelligent diffs.
     
    carlosalba1985 likes this.