Sfdx-git-delta: Comparing branches not generating package.xml

Created on 4 Feb 2021  ·  25Comments  ·  Source: scolladon/sfdx-git-delta

Hi

On git i have 2 branches develop and master.
When i comparing this branches

sfdx sgd:source:delta --to develop --from master --output .
or sfdx sgd:source:delta --to master --from develop --output .

package.xml is empty

2021-02-04T05:32:20.2760251Z --- package.xml generated with added and modified metadata ---
2021-02-04T05:32:20.2771449Z
2021-02-04T05:32:20.2772362Z
2021-02-04T05:32:20.2773243Z 50.0
2021-02-04T05:32:20.2778039Z

2021-02-04T05:32:20.2778917Z ---- Deploying added and modified metadata ----

Here is git diff command :

diff --git a/.forceignore b/.forceignore
index e43b90c..a4d576c 100644
--- a/.forceignore
+++ b/.forceignore
@@ -10,5 +10,5 @@ package.xml

# LWC Jest
/__tests__/
-listView-meta.xml
+#
listView-meta.xml

diff --git a/force-app/main/default/classes/CaseHandler.cls b/force-app/main/default/classes/CaseHandler.cls
deleted file mode 100644
index a88ebe9..0000000
--- a/force-app/main/default/classes/CaseHandler.cls
+++ /dev/null
@@ -1,5 +0,0 @@
-public with sharing class CaseHandler {

  • public CaseHandler() {
    -
  • }
    -}
    diff --git a/force-app/main/default/classes/CaseHandler.cls-meta.xml b/force-app/main/default/classes/CaseHandler.cls-meta.xml
    deleted file mode 100644
    index 541584f..0000000
    --- a/force-app/main/default/classes/CaseHandler.cls-meta.xml
    +++ /dev/null
    @@ -1,5 +0,0 @@
    -
    -
  • 50.0
  • Active
    -
    diff --git a/force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js b/force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js
    deleted file mode 100644
    index 843c9bd..0000000
    --- a/force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -import { LightningElement } from 'lwc';
    -
    -export default class OppQuickLinks extends LightningElement {}
    \ No newline at end of file
    diff --git a/force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.html b/force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.html
    similarity index 100%
    rename from force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.html
    rename to force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.html
    diff --git a/force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.js b/force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.js
    new file mode 100644
    index 0000000..d1422ea
    --- /dev/null
    +++ b/force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.js
    @@ -0,0 +1,3 @@
    +import { LightningElement } from 'lwc';
    +
    +export default class OpportunityQuickLinks extends LightningElement {}
    \ No newline at end of file
    diff --git a/force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js-meta.xml b/force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.js-meta.xml
    similarity index 71%
    rename from force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js-meta.xml
    rename to force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.js-meta.xml
    index d9b205e..bcfbfde 100644
    --- a/force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js-meta.xml
    +++ b/force-app/main/default/lwc/opportunityQuickLinks/opportunityQuickLinks.js-meta.xml
    @@ -1,5 +1,5 @@


    50.0
  • false
  • true
bug reproduction steps needed

All 25 comments

Hi @g1b3r !

Thanks for this issue.
I think we will need to discuss a little bit so we can discover the root cause of this issue.

Can you tell us those informations :
Operating System:
Yarn version:
Node version:
sgd version:
git version:
You can get those with the following command in unix system : $ uname -v ; yarn -v ; node -v ; sgd --version ; git --version

Could you also display the result of this command :
git diff develop master --names-status

Thanks in advance

Hi @scolladon

OS - ubuntu-20.04
Yarn - 1.22.5
Node - v14.15.4
sdg - latest one (installing every time on start script when i run on ubuntu i got sgd: command not found)
git version 2.30.0

git diff develop master --name-status
D force-app/main/default/classes/CaseHandler.cls
D force-app/main/default/classes/CaseHandler.cls-meta.xml
D force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.html
D force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js
D force-app/main/default/lwc/oppQuickLinks/oppQuickLinks.js-meta.xml
D force-app/main/default/triggers/CaseTrigger.trigger
D force-app/main/default/triggers/CaseTrigger.trigger-meta.xml

Thank you

When running the command (-f master -t develop), what is the content of the destructiveChanges.xml file generated ?

--- package.xml generated with added and modified metadata ---


50.0

---- Deploying added and modified metadata ----
=== Deployed Source
No results found
--- destructiveChanges.xml generated with deleted metadata ---


50.0

--- Deleting removed metadata ---

@g1b3r I need a little bit more explanation to understand.

As I can see the diff command display only deletion information, that's probably the reason why there is no content in the package.xml. The plugin is going to store those information in the destructiveChanges.xml.

Does the content of the destructiveChanges.xml reflect the output from the git diff ?

@scolladon

No , destructive is empty

In my last comment there is a empty destructive.xml and empty package.xml (github formated my comment)

This is a only example

I tried to add something to repo to generate a different compare but in multiple cases which i try, there is a always empty package.xml and destructive changes

BR

@g1b3r can you provide reproduction step with a temporary repository so I can try by myself please ?

Hi @g1b3r !

I really want to help !
My guess is that maybe this issue occurs in a CI context, where it maybe don't have full git clone depth.
This could lead to this error during the git diff done by the plugin.

Nevertheless, I have created a repository here to be able to troubleshoot and reproduce this kind of situation.
Please create a branch issue/97 with the content of the repository which allow you to reproduce the issue and share that with us.

We will try to reproduce in the same environment as you do (Ubuntu 20.04)

Thanks in advance

HI @scolladon

Big sorry for delay but i was unavailable for one month :(

I will let you know about progress

Sorry again

Hi i tried to reproduce that issue but still i got empty package.xml :(

@g1b3r please create a branch issue/97 in this repository and put the state to reproduce the issue and share that with us.

@scolladon
Im unable todo that
remote: Permission to scolladon/sfdx-git-delta-reproduction-playground.git denied to g1b3r.

Try in your own fork please

I tried run CI but now on every run i got

TypeError: Class constructor SfdxCommand cannot be invoked without 'new'
/home/vsts/work/_temp/8f6184a3-a857-4460-b744-89eda433b63a.sh: line 14: //sfdx: No such file or directory

Hi @g1b3r,

There is an issue with the version v4.3.0.
A fix has been shipped (v4.3.1), could you retry using this one ?

HI @scolladon

I tried new version but still i got empty package.xml

I will send PR from my fork shortly

BR

Thanks for having created the branch.
I have been able to look at it.

Sorry, I do not reproduce the issue with the reproduction branch

When I execute the command I have the package.xml filled properly :

$ git fetch origin pull/2/head:issue/97
$ git checkout issue/97
$ mkdir output
$ sfdx sgd:source:delta -f "HEAD~1" -d
$ cat mac-output/package/package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>AccountTrigger</members>
        <name>ApexTrigger</name>
    </types>
    <version>50.0</version>
</Package>

Maybe we should schedule a screen sharing session to better understand what is the root cause of the issue.
If you are available for that I will create a discord link

Yes but you run compare of last 2 revisions not branches

Try to compare master and issue/97 branch

BR

Same result for me

When I execute the command I have the package.xml filled properly :

$ git fetch origin pull/2/head:issue/97
$ git checkout issue/97
$ mkdir output
$ sfdx sgd:source:delta -f "master" -t "issue/97" -d
$ cat mac-output/package/package.xml
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>AccountTrigger</members>
        <name>ApexTrigger</name>
    </types>
    <version>50.0</version>
</Package>

if i run in CI contex no package generated

Here is log

2021-04-07T08:40:11.1423958Z warning sfdx-git-delta > @salesforce/core > jsforce > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
2021-04-07T08:40:11.1425584Z warning sfdx-git-delta > @salesforce/core > jsforce > request > [email protected]: this library is no longer supported
2021-04-07T08:40:12.4324930Z Successfully authorized ceran.[email protected] with org ID 00D09000003R6e4EAC
2021-04-07T08:40:13.9112678Z {
2021-04-07T08:40:13.9123593Z "error": null,
2021-04-07T08:40:13.9137875Z "output": "./output",
2021-04-07T08:40:13.9138963Z "success": true,
2021-04-07T08:40:13.9139331Z "warnings": []
2021-04-07T08:40:13.9139646Z }
2021-04-07T08:40:14.0062157Z ---Current Folder---
2021-04-07T08:40:14.0209911Z README.md
2021-04-07T08:40:14.0210902Z config
2021-04-07T08:40:14.0211225Z devops
2021-04-07T08:40:14.0216103Z force-app
2021-04-07T08:40:14.0216478Z manifest
2021-04-07T08:40:14.0217079Z output
2021-04-07T08:40:14.0217335Z package.json
2021-04-07T08:40:14.0217841Z scripts
2021-04-07T08:40:14.0218098Z server.csr
2021-04-07T08:40:14.0218570Z server.key
2021-04-07T08:40:14.0218832Z server.pass.key
2021-04-07T08:40:14.0219307Z sfdx-bitbucket-org
2021-04-07T08:40:14.0219771Z sfdx-project.json
2021-04-07T08:40:14.0220218Z ---Current Folder---
2021-04-07T08:40:14.0271349Z destructiveChanges
2021-04-07T08:40:14.0272164Z package
2021-04-07T08:40:14.0277546Z ---Current Folder---
2021-04-07T08:40:14.0288586Z package.xml
2021-04-07T08:40:14.0294443Z ---End of Listing---
2021-04-07T08:40:14.0304189Z
2021-04-07T08:40:14.0305172Z
2021-04-07T08:40:14.0305897Z 50.0
2021-04-07T08:40:14.0311099Z

2021-04-07T08:40:14.0312254Z ---- Deploying added and modified metadata ----
2021-04-07T08:40:18.7312258Z === Deployed Source
2021-04-07T08:40:18.7319301Z No results found
2021-04-07T08:40:18.7827860Z --- destructiveChanges.xml generated with deleted metadata ---
2021-04-07T08:40:18.7842240Z cat: destructiveChanges/destructiveChanges.xml: No such file or directory
2021-04-07T08:40:18.7889402Z
2021-04-07T08:40:18.7890704Z --- Deleting removed metadata ---
2021-04-07T08:40:18.8004757Z ##[section]Finishing: Bash Script

I think we should review that CI to understand what is happening here

@g1b3r any update about this issue ?
Do you manage to make it works ? Workaround ?
Do you still want us to review it ?

Hello

I tried but still it give me error. Maybe we can schedule screen share session to explain how my CI is configured
Im free almost every time this week

BR

Pozdrawiam
Łukasz Ceran


Od: Sebastien @.>
Wysłane: Wednesday, April 28, 2021 10:20:20 AM
Do: scolladon/sfdx-git-delta *
@.>
DW: g1b3r
@.>; Mention @.*>
Temat: Re: [scolladon/sfdx-git-delta] Comparing branches not generating package.xml (#97)

@g1b3rhttps://github.com/g1b3r any update about this issue ?
Do you manage to make it works ? Workaround ?
Do you still want us to review it ?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/scolladon/sfdx-git-delta/issues/97#issuecomment-828254201, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AELCZC2MLJBJXT4YER3UXDDTK7AMJANCNFSM4XCFT37A.

Ok then, contact me on gitter please

Hi

Solved with you help. Issue was on my side i azure devops pipelines :)

this to commands added to bash script solved issue
git checkout develop
git checkout master

Thank you very much :)

Its great tool !!!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arafesthain picture arafesthain  ·  7Comments

robertoamd90 picture robertoamd90  ·  4Comments

arafesthain picture arafesthain  ·  9Comments

Dhanielk picture Dhanielk  ·  6Comments

lcee-info picture lcee-info  ·  8Comments