merge-request-integration icon indicating copy to clipboard operation
merge-request-integration copied to clipboard

Update to directly use git to calculate changes for diffs

Open jackbentley opened this issue 4 years ago • 2 comments

Fixes #72

I'm not primarily a Java/Kotlin developer so this took some time to figure out. There's might be some mistakes and there might well be a better way of doing this.

I know that these changes won't be compatible with the feature that allows you to select which commits to review from the MR. This will now only allow you to compare the source and target branch.

From what I can gather the plugin currently calculates the changes by combining the changeset of the commits in the MR.

For example, if the two branches are updated simultaneously and merged together, you will end up seeing the changes from the target branch/merge commit in the diff.

This isn't the same as a git diff.

The changes I've made make it the exact equivalent of running git diff <target>..<source> (because it actually runs that command).

Given that it now runs the commit command, it means it's obviously only compatible with Git but I don't think that's an issue as other parts of the plugin are tailored to git only.

In order to re-implement the "select commits to compare" feature, you will likely need to use the merge-base command as explained here or find another way of doing what the MR does.

jackbentley avatar Jul 20 '20 18:07 jackbentley

Thanks for contribution, based on this I'll fix a commits problem add add new option in the configuration, then users have a choice to pick between 2 methods.

nhat-phan avatar Aug 16 '20 15:08 nhat-phan

Any news on this MR ?

Nico04 avatar Oct 16 '20 12:10 Nico04