Closed jonathanmorris180 closed 1 month ago
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.
Hello @jonathanmorris180, it looks like this error is happening because source tracking is trying to track a file outside of it's root directory and it is not allowed.
If you run the command with the --dev-debug
flag, you will see an error coming from the source tracking "shadow repo" which uses the isomorphic-git library. Here is an example in iso-git where they throw an error when the path includes going up a directory. This was patched in this iso-git PR
One way to avoid this would be to create an org without source tracking:
sf org create scratch --no-track-source
Or you could do the retrieve in metadata format instead of source format, this bypasses source tracking (source-code)
Retrieve in metadata format (and unzip)
sf project retrieve start -m "ApexClass:TestClass" --target-metadata-dir /your/tmp/dir --unzip
Then if you need to convert it to source format you could with:
sf project convert mdapi --root-dir /your/tmp/dir/unpackaged --output-dir /your/tmp/dir/converted
Hi @iowillhoit, thanks for looking into this. Interesting to learn about the shadow repo! Retrieving in metadata format fixed the issue.
Summary
When a file is pulled into a temporary directory using
sf project retrieve start
, the CLI returns the following error:This is causing issues for a Neovim plugin I have written as I use temp directories to diff files in the org. After I retrieve a file into a temp directory for diffing with the file in the current project, I can no longer push components to the org because the error is thrown. The only workaround I have found to fix the issue is to
rm -rf .sf/orgs/*
in the project after I have run a diff.Steps To Reproduce
Run the following script (replace
<username-or-alias>
appropriately):Expected result
The component should retrieve from the org into the temp directory without any issues.
Actual result
Error is thrown.
System Information
System Version: macOS 14.6.1 (23G93) Shell info:
sf version --verbose --json
output: