All Collections
Troubleshooting
Version control
Whitespace changes for DX repos
Whitespace changes for DX repos

Why am I seeing changes where spacing is being removed?

Alex Walter avatar
Written by Alex Walter
Updated over a week ago

In the release v2.0.10032.1, we made a change to the whitespace when deploying to DX format git repos:

What this change is

Previously Gearset was adding an extra 4 spaces to each line within the components of object files:

We now no longer add these extra spaces:

Why did we make this change?

We made this change to be consistent with the whitespace in files when you run force:source:pull or force:source:retrieve using the SFDX CLI.

The extra spacing was causing merge conflicts for users who used Gearset in conjunction with the SFDX CLI.

Which files does this change affect?

  • This will only have an effect if you are using a DX format repo.

  • This will affect components in Custom Objects, including: Custom Fields, Business Processes, List Views, Filters, Record Types, Sharing reasons, Validation Rules and Weblinks. For example the Custom Fields files in the objects/OBJECT_NAME/fields/ folder will show this change.

  • It will affect all components for the file if you have a change within the Custom Object

How will this change show up?

As this is a change to Gearset's behavior, if you have previously deployed just using Gearset, this will show up as a whitespace change on existing files:

In the short term this means your next deployment to each custom object will
result in some extra noise in the form of whitespace changes, but going forwards the XML will be more consistent with what the SFDX CLI produces and so provide a better experience for users of different tools across your teams.

Tips for ignoring whitespace changes in git

If you want to ignore the whitespace changes in a comparison in GitHub, you can select Hide whitespace changes in the settings for a comparison or a Pull Request:

You are also able to do this by adding a ?w=1 to the URL (or just adding w=1 if you already have a ? in your URL). This also works for most other source control systems such as GitLab, and Bitbucket.

How you can sync all these whitespace changes at once

These changes will happen for all components in an object, when the object or a component of the object gets deployed. If you want to copy all these changes at once, you can follow these steps:

Create a new branch off master in your repo, called something like sync-custom-object-whitespace

On your machine: select all the files and folders in the objects folder and delete them.

Commit these deletions to the branch and push the branch to the repository.

Run a comparison in Gearset between the Salesforce org (Source) and the sync-custom-object-whitespace branch for just the Custom Objects (ensuring Include managed packages is set to None)

Select all the new items

Then deploy them

Create a pull request

View the pull request and hide the whitespace changes (see section above)

The changes should show only whitespace changes

Once this is merged in, you should not see any whitespace changes on the components in future deployments.

Did this answer your question?