cli icon indicating copy to clipboard operation
cli copied to clipboard

End of line is not respected by "sfdx force:source:retrieve or deploy" command

Open mostafa-anm opened this issue 4 years ago • 4 comments

Summary

We are using prettier code formatter, which by default preserves line ending.

However when we commit, deploy and then retrieve, ending lines are removed from my local files, creating large diffs.

That happens on APEX, AURA and LWC files.

Steps To Reproduce:

  1. Create an apex class MyCls with an empty line at the end.
  2. Commit this class locally using git.
  3. Deploy the class to a sandbox using sfdx force:source:deploy.
  4. Retrieve the class from the sandbox using sfdx force:source:retrieve.
  5. Run git diff.

Expected result

The retrieved apex class should not have been changed.

Actual result

Ending line is removed from the apex class creating an unnecessary diff.

Additional information

SFDX CLI Version:

sfdx-cli/7.45.1 darwin-x64 node-v12.16.0

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core)

@salesforce/sfdx-diff 0.0.5
@salesforce/sfdx-trust 3.0.7 (core)
analytics 1.7.0 (core)
dependencies-cli 2.0.1
generator 1.1.2 (core)
salesforcedx 47.18.0
├─ salesforce-alm 47.16.0
└─ salesforcedx-templates 47.19.0

sfdx-cli 7.45.1 (core)

OS and version:

macOS Mojave
10.14.6

mostafa-anm avatar Feb 17 '20 13:02 mostafa-anm

@mostafa-anm we are having the mdapi team take a look at this issue.

clairebianchi avatar Feb 25 '20 22:02 clairebianchi

+1

dieffrei avatar Oct 09 '21 16:10 dieffrei

this is still happening. Any news?

alexferrari88 avatar Dec 29 '21 08:12 alexferrari88

@mostafa-anm I had the same issue. I have added this to the prettier config file to prevent the diffs: { "files": "*.{cls,trigger}", "options": { "apexInsertFinalNewline": false } }

jdgirald avatar Sep 28 '22 19:09 jdgirald