scolladon / sfdx-git-delta

Generate the sfdx content in source format from two git commits
Other
415 stars 112 forks source link

Empty package on windows #96

Closed haroldo-bonette closed 3 years ago

haroldo-bonette commented 3 years ago

What is the problem

SGD generating empty package in windows although 'git diff HEAD^^ HEAD' shows changes correctly.

What is parameter and their value you used

Tried all these: sfdx sgd:source:delta --to HEAD --from HEAD^ --output . sfdx sgd:source:delta --to HEAD --from HEAD^^ --output . sfdx sgd:source:delta --to 325688c --from d0d707a --output .

What is the expected result

Package file containing the latest changes

What is the actual result

<?xml version="1.0" encoding="UTF-8"?>

50.0

Steps to reproduce


-Install sfdx-cli through npm -install sfdx-git-delta plugin -make any change in your rep (apex/force-app) and commit/push your changes -source "git diff HEAD^^ HEAD" to ensure your change is listed by git

Execution context


Optional more information

git diff --name-status --no-renames HEAD^^ HEAD M scripts/apex/hello.apex

scolladon commented 3 years ago

Hi @haroldo-bonette !

Thanks for this issue. It is very clear.

Could you provide also information about the contexte please ?

Operating System:

Yarn version:

Node version:

sgd version:

git Version:

haroldo-bonette commented 3 years ago

One more thing I've just found out is that it works for some objects, so not sure there is a limitation/configuration which objects types should be part of the package?

git diff --name-status --no-renames d4533cba825f121a4a7438bb61e538389bb51f80 HEAD M force-app/main/default/appMenus/Salesforce1.appMenu-meta.xml <---- this one shows up in the package.xml M force-app/main/default/labels/CustomLabels.labels-meta.xml M scripts/apex/hello.apex

sfdx sgd:source:delta --to HEAD --from d4533cba825f121a4a7438bb61e538389bb51f80 --output . -a 51 { "error": null, "output": ".", "success": true, "warnings": [] }

 <Package xmlns="http://soap.sforce.com/2006/04/metadata">
     <types>
         <members>Salesforce1</members>
         <name>AppMenu</name>
     </types>
     <version>51.0</version>
 </Package>

Win 2012 R2

git version 2.20.1.windows.1

node -v v14.15.4

sfdx plugins --core @oclif/plugin-autocomplete 0.1.5 (core) @oclif/plugin-commands 1.3.0 (core) @oclif/plugin-help 3.2.1 (core) @oclif/plugin-not-found 1.2.4 (core) @oclif/plugin-plugins 1.9.5 (core) @oclif/plugin-update 1.3.10 (core) @oclif/plugin-warn-if-update-available 1.7.0 (core) @oclif/plugin-which 1.0.3 (core) @salesforce/sfdx-trust 3.6.0 (core) alias 1.1.3 (core) analytics 1.12.1 (core) auth 1.4.7 (core) config 1.2.1 (core) generator 1.1.5 (core) salesforcedx 50.7.1 (core) ├─ schema 1.0.3 (core) ├─ custom-metadata 1.0.10 (core) ├─ templates 50.1.0 (core) ├─ salesforce-alm 50.7.1 (core) ├─ @salesforce/sfdx-plugin-lwc-test 0.1.7 (core) └─ apex 0.1.4 (core) sfdx-cli 7.82.1-0 (core) sfdx-ext 0.0.49 sfdx-git-delta 4.2.0

scolladon commented 3 years ago

Thanks !!

Can you display the diff for the file force-app/main/default/labels/CustomLabels.labels-meta.xml please ?

Seb

haroldo-bonette commented 3 years ago
index d50b84b..10feea9 100644
--- a/force-app/main/default/labels/CustomLabels.labels-meta.xml
+++ b/force-app/main/default/labels/CustomLabels.labels-meta.xml
@@ -100,7 +100,7 @@
         <language>en_US</language>
         <protected>false</protected>
         <shortDescription>Case Queue</shortDescription>
-        <value></value>
+        <value>456a0630-cd8c-5e3c-a8b2-fd0f249e57cd</value>
     </labels>
scolladon commented 3 years ago

Related to #47

@haroldo-bonette I tried to reproduce it locally on my mac without success. Something you could try is to surround parameter values with double quote ex : sfdx sgd:source:delta --to "HEAD" --from "d4533cba825f121a4a7438bb61e538389bb51f80" --output . -a 50 Let me know if it changes anything. If not I will need your help to reproduce and trouble shoot :)

Also, I noticed you passed the API version 51 which is not already available in the plugin so it fallback in the 50 ( we will release the 51 soon).

haroldo-bonette commented 3 years ago

Hi @scolladon, so it seems one issue was with the escape char "^", for some reason even if we use the escape char to escape the escape char in windows cmd ex: "^^", SFDX is not able to understand it like git is, that was resolved by using the double quotes, thanks for the tip. If using the escape "^" on Windows ensure you use double quotes: ex : sfdx sgd:source:delta --to HEAD --from "HEAD^" --output . -a 50

Second issue was I did not pay attention to the order of the commit hashes while sourcing sfdx command, while in "git diff" it does not matter I can see in the plugin we should respect the "to/from" order, being "from" the oldest commit and "to" the more recent. right: sfdx sgd:source:delta --to HEAD --from "HEAD^" --output . wrong: sfdx sgd:source:delta --to "HEAD^^" --from "HEAD" --output .

If I follow the above it seems to be working fine.

Thanks for your help and sorry for any inconvenience.

scolladon commented 3 years ago

You're welcome !

Thanks for the details explanations, your time and your interest in the plugin trying to make it better !

afzal-tag commented 3 years ago

Here is what worked for me. Hope its helpful.

sfdx sgd:source:delta --to HEAD --from HEAD~1 --output .

scolladon commented 3 years ago

You're right @afzal-tag !

^ character is used to escape other character in windows (like \ for unix)

So the portable way to write delta deployment from the n-th commit since HEAD is : HEAD~n

I'll make a change in the README to reflect that

Thanks a lot