On the 7th August 2018 we changed the way Gearset writes metadata into repositories to better preserve whitespace and XML formatting.
If you've been using Gearset with version control prior to the 7th August 2018, you may see more changes than you were expecting the next time you deploy into git. This article explains the changes we've made and what to expect.
Previously, Gearset would remove whitespace between metadata components as part of our automatic decomposition process. This meant that metadata elements would end up having their
end tag on the same line as the
starting tag for the next element.
Now, Gearset will look at the indentation of the last element of the previous component and use it as the indentation for the following element (with a default indentation of four spaces if there's no sample to copy). Whitespace is otherwise preserved.
How does this change the XML?
The changes to the XML formatting are demonstrated below. On the left, the format Gearset would previously have written to git. On the right, the newer format.
Looking a bit more closely at one example element, in this case the "Warehouse_classic" Application visibility in this profile, the change is clearly seen. With the new changes, the element now starts and ends on separate lines.
Why we made the change
The new format is more in line with how other tools format and write XML. This means if you're working with Mavens or Eclipse for example, or even writing code by hand, Gearset will no longer cause files to be modified when writing into git and will cause fewer conflicts between branches.
How this will affect you
The next time you deploy metadata into a repository which you've previously used with Gearset, you'll see a large number of changes to the XML as we re-format each component to update with the newer formatting. For large objects such as profiles, this can mean thousands of lines of changes.
You may also run into merge conflicts if you are merging two branches which have modified the same file, when one branch is using the newer Gearset format and one the older format.
The good news is you'll only see these changes with the first deployment you run into your repository. After the first deployment, your XML will be in the updated format and you won't see any additional line ending modifications.
You'll also find that if you commit changes into your repository from other sources, such as MavensMate, you will no longer see conflicts between the formatting from Gearset and from these tools. This will make your merging process much faster and easier.