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

fix: delta after merge is not working as expected #1118

Merged
merged 2 commits into from
Mar 13, 2025

Conversation

DidZ0
Copy link
Contributor

@DidZ0 DidZ0 commented Mar 11, 2025

Fixes an issue where delta deployment after merging a PR isn't calculated correctly.

The issues seems to be the orientation of the delta calculation from "HEAD" to "HEAD^", generating destructive changes if the metadata is new.

inverting the references fixes the issue.

Thus, the way sfdx-git-delta is used while deploying, it will only generate the delta with the latest commit.
A temporary workaround would be to activate Squash Commits in the merge request.

@nvuillam
Copy link
Member

@DidZ0 good catch !
The bug was probably never caught because of Quick Deploy always used after merge

I'm not the biggest git expert, are you 100% sure of your fix ?

@DidZ0
Copy link
Contributor Author

DidZ0 commented Mar 11, 2025

@nvuillam
As far as I'm concerned this isn't even git related, it has more to do with the way sfdx-git-delta is working.
I'm pretty sure this fix is valid as we indeed want to find what is new from the last commit, not what is deleted / changed if we go back to the last commit.

CF https://github.com/scolladon/sfdx-git-delta?tab=readme-ov-file

From the project repo folder, the CI pipeline will run the following command:

sf sgd source delta --to "HEAD" --from "HEAD~1" --output-dir .

which means:
Analyze the difference between HEAD (latest commit) and HEAD~1 (previous commit), and output the result in the current folder.

This is what you're doing in the check-deploy since you're comparing from the first commit ID of the PR to the last one

@nvuillam
Copy link
Member

@DidZ0 I generated an alpha version, please can you test with it and confirm that all is ok ? :)

Thanks :)

@DidZ0
Copy link
Contributor Author

DidZ0 commented Mar 12, 2025

@nvuillam So far so good ! It is working as intended, the delta is the same pre and post deployment.
I know this is not a common use case but it would be great to have it.

@nvuillam
Copy link
Member

@DidZ0 thanks for your feedback, you'll have it very soon, just the time i'm on a laptop 🥳

@nvuillam nvuillam merged commit 4341555 into hardisgroupcom:main Mar 13, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants