Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error output must be added to stdout when using --json #568

Closed
AllanOricil opened this issue Apr 12, 2023 · 4 comments · Fixed by #608
Closed

error output must be added to stdout when using --json #568

AllanOricil opened this issue Apr 12, 2023 · 4 comments · Fixed by #608
Assignees
Labels
enhancement New feature or request

Comments

@AllanOricil
Copy link
Contributor

AllanOricil commented Apr 12, 2023

Is your proposal related to a problem?

every other sfdx command send error messages to stdout when using --json, but sgd does not

image

edit: I noticed that there is a warning message in the error key, instead of being in the warnings array. I think this is confusing.

Actual Output

{
    "status" : 1,
    "result" : null
}

Expected Output

{
    "status" : 1,
    "result" : {
        "success": false,
        "error": "error message"
        "warnings": [],
        "output":  <OUTPUT_DIR>
    }
}
@AllanOricil AllanOricil added the enhancement New feature or request label Apr 12, 2023
@scolladon
Copy link
Owner

scolladon commented Apr 17, 2023

Hi @AllanOricil !

Thanks for this enhancement and thanks for contributing in making this project better!

I think it is somehow related to this enhancement as well.

I do not know yet how we will treat this as a whole, but we definitely need to be compliant with the standard sfdx output behavior (which is not the case currently).
The constraint we have is we cannot introduce breaking change because current usage is based on the actual behavior.
We need to be careful when addressing this.

One way I was thinking about was to deal with this behavior compliance when migrating to sf and leave the sfdx plugin behavior as it is currently. It will be easier to introduce new behavior during this transition.


For the warning in the error attribute, that is a very good point, nice catch, I'll try to work on that soon.
Just to be sure, in order to reproduce I have to create a tag having the same name as a branch, and pass that refname to the --from parameter so git get confused ?

@AllanOricil
Copy link
Contributor Author

AllanOricil commented Apr 17, 2023

@scolladon this git warning message is displayed when you try to fetch a ref from remote and map it to a local ref that already exists in any other ref namespace:

refs/<refname> 
refs/tags/<refname>
refs/heads/<refname>
refs/remotes/<refname>
refs/remotes/<refname>/HEAD

for instance:

git fetch origin +ref_name:ref_name

image

image

I think you should try/catch this error because Git does not exit with error when this message is displayed
image

@AllanOricil
Copy link
Contributor Author

AllanOricil commented Apr 18, 2023

@scolladon this error happens because Im using a single command to fetch both "from" and "to" at the same time.

git fetch origin +$git_ref_from:$git_ref_from +$git_ref_to:$git_ref_to"

when git_ref_to is empty, I set it to HEAD, then this happens

image

I did this way to avoid having to treat tags and branches differently, and to fetch exactly only what is necessary for SGD to compute the delta

@github-actions
Copy link

Shipped in release v5.20.0.
You can install the new version using the version number or the latest-rc channel

$ sfdx plugins:install sfdx-git-delta@latest-rc
$ sfdx plugins:install [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants