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: Diff does not work as expected #557

Closed
1 task done
cameronklein opened this issue Aug 11, 2023 · 5 comments · Fixed by #669
Closed
1 task done

fix: Diff does not work as expected #557

cameronklein opened this issue Aug 11, 2023 · 5 comments · Fixed by #669
Labels
bug Something isn't working Needs: Triage The issue needs triaging

Comments

@cameronklein
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Version

3.1.1

Description

#454 changed the diff functionality by moving from git diff to git log.

The result can be identical in some cases, but not in all.

Notably it fails when maintaining a branch into which main has been merged. git log will flag packages that have changed in main since the branch was branched, even if the branch is fully up to date.

(This is because the merge commits will appear in the affected packages when git log -- . is run.)

The old code prior to #454 works as one would expect.

Steps to reproduce

  1. Have two packages, foo and bar in main
  2. Create a branch feature from main.
  3. Make changes to the bar package and commit them in the feature branch.
  4. Back on main, make changes to the foo package and commit them.
  5. Back on the feature branch, merge main into feature.
  6. run melos exec --diff=main -- "echo hello"
  7. Note that both packages are saying hello.
  8. cd into the foo package and run git diff main...HEAD -- . and note that the diff is empty.

Expected behavior

The documentation example notes that the diff command will:
Run 'flutter build iOS' on all packages that are different between current branch and the specified commit hash.

Melos should execute on only those packages that are different between the current branch and the specified commit hash.

Screenshots

No response

Additional context and comments

No response

@cameronklein cameronklein added bug Something isn't working Needs: Triage The issue needs triaging labels Aug 11, 2023
@xsahil03x
Copy link
Contributor

Hey @spydon any update on this issue? Thanks

@spydon
Copy link
Collaborator

spydon commented Mar 13, 2024

Hey @spydon any update on this issue? Thanks

There hasn't been any work done on this, if you know how to fix it feel free to provide a PR and I'll review it. :)
(Without completely reverting the other changes)

@xsahil03x
Copy link
Contributor

@spydon can you guide or suggest me some ideas to make it support both the functionality? I can quickly work on a PR. Thanks

@spydon
Copy link
Collaborator

spydon commented Mar 14, 2024

@xsahil03x I haven't been involved in any of this functionality so I don't know unfortunately. I would suggest looking at the PR that simplified it and see what was changed there.

@xsahil03x
Copy link
Contributor

Hey @spydon, I checked this #558 PR from @cameronklein and it looks perfect for solving this issue. I don't think we need to make any more changes. I can recreate the same PR cherryPicking his commits if you can review it. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Needs: Triage The issue needs triaging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants