-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
Too many diff in the output #892
Comments
Hi @Bartheleway ! Thanks for raising this issue and thanks for contributing in making this project better! I think what you want to do is to compare based with the common ancestor (sort of) Let me know if it helps :) |
Hi, thanks for your answer, I will look into it and let you know. |
Sure, we had a version where we did the actual diff.
Then why not use |
Okay, I tried your suggestion and indeed seems to produce the correct result. Well I didn't know spawn was slow and in use when you do a git diff. I suppose it depends on the library used, "simple-git" most certainly use it as it requires git to be installed and is a wrapper around git commands but "isomorphic-git" seems to not use it. Additionally, I would like to known when do we need to make a comparison using branch state instead of common ancestor? For me using the common ancestor should be the default behavior. Could it be that we add an option to CLI like |
I think it should not be the default behaviour because it would force users to have a particular process / way to use the plugin. I would rather let the users have the control to provide what is the value of the parameters they want to set, never minding the way it is defined, without assuming the plugin knows best to do it. |
When I use GitHub PR, GitLab MR or git diff I just give two ref/branch and it makes the diff using the common ancestor. I don't understand why this tool would behave differently ... I think it is confusing that a "diff" tool is behaving differently than others by default. Having to use I wonder how many user out here already used From a side note, I see using |
When doing a pull request (in any provider), it compares the top of the current branch with the top of the target branch (even if it has changed in between). This is why some of the git provider propose to require the "branch to be up to date" or enforce having a "linear history". |
Feel free to reopen this issue if you think there is more to discuss. |
Could explain how it should be done in CI then? (I am currently working on this topic) From what we discuss internally with my team, doing the |
What I meant by it is done differently in CI is that in some CI there can be environment variable containing the base branch at its current state. So you may use those environment variable. Also some CIs merge the PR branch "locally" (in the container) before applying all the checks configured. I don't see how the integration with other development is done when comparing with common ancestor. public class MyService {
public class doAwesomeThings() {
// magic here
}
} Now we create a branch public class MyService {
public class doAwesomeThings() {
// magic here
}
public class doOtherThings() {
// unicorn taming here
}
} If in the mean time someone as merged into main a public class MyService {
public class doAwesomeThings() {
// magic here
}
public class doThings() {
// normal stuff here
}
} Those changes will not be included in the PR checks if the comparison is done against the common ancestor |
I agree with you, content of files will only be correct if branch is on top of compared branch (or if diffs are located on other files). I was about to miss that point, thanks for reminding me that. From what I saw, SGD is therefore only in charge of generating the manisfest and doesn't care about file content. And yes of course I am using CI environment variable to know with ref I need to use :) |
SGD also generate partial metadata for any metadata type allowing it to be deployed. It is done using the It also list all the listable metadata contained inside files in the package.xml (per exemple Labels, SharingRules, Workflows, etc) |
What is the problem?
When using the plugin to generate diff between two branches, it gives a diff bigger than expected.
What is the parameter and the value you used with it?
Given that "master" is my default branch representing the prod env and that I am currently on my feature branch.
My feature branch is 1 commit behind master and have 1 commit that is not currently on master.
sf sgd:source:delta --to "origin/master" --from HEAD
What is the expected result?
Diff should only contains the commit which is not on master.
What is the actual result?
Diff contains both commit
Steps to reproduce
Execution context
Operating System: Windows
yarn version: 4.2.1
node version: 21.7.1
git version: 2.39.0
sfdx version: 2.45.6
sgd plugin version: 5.40.2
More information (optional)
Looking at the source code, I see that plugin gets the diffs from walking through commits.
I think it should simply use the
git diff
command instead of recreating it.Doing
git diff origin/master...HEAD --name-only
produce the expected list of modified files.The text was updated successfully, but these errors were encountered: