|
|
Subscribe / Log in / New account

Git 2.36.0 released

Version 2.36.0 of the Git source-code management system is out. As usual, the list of new features is long; this GitHub blog post covers some of the highlights:

But this [merge conflict] output can be understandably difficult to interpret. In Git 2.36, --remerge-diff takes a different approach. Instead of showing you the diffs between the merge resolution and each parent simultaneously, --remerge-diff shows you the diff between the file with merge conflicts, and the resolution.


to post comments

Git 2.36.0 released

Posted Apr 19, 2022 9:56 UTC (Tue) by osma (subscriber, #6912) [Link] (3 responses)

I find the --remerge-diff example extremely confusing, but maybe that's just me. The old-style output is very clear, but I can't figure out the new one.

Git 2.36.0 released

Posted Apr 19, 2022 11:27 UTC (Tue) by mathstuf (subscriber, #69389) [Link]

I don't find the old style clear at all. I usually just ignore such messes and look at the new code as-is to try and figure out if it makes sense. If needed, I look at each diff individually to make sure its change got in the resulting resolution.

The new one is fine because I see 3-way diffs all the time. I can see that line X came from side A and line Y came from side B very easily. If there's a line which is different from any change, it shows up as a modified line instead of a series of line removals.

Git 2.36.0 released

Posted Apr 19, 2022 20:05 UTC (Tue) by iabervon (subscriber, #722) [Link]

I find the traditional one easy to understand backwards. It looks to me like it's saying which changes each side contributed to the resulting commit, but it's actually saying which changes each side didn't already contain. In the example, the wrong interpretation is equivalent to the right one (if you don't pay attention to the order of columns and order of parents), but then the output is very surprising if the merge discarded some changes from one side or the other or introduced entirely new code in order to make the features work together.

I think the new one can only be understood correctly or not at all, and is much more clearly saying "this is how the conflict was resolved"; on the other hand, conflict resolution is a difficult skill, and this relies on it in order to make sense of the output.

I think there might be a way to present it as a diff from the common answer to the merge result, marked with attribution as to the side it came through (or marked that it was new in the merge commit).

Git 2.36.0 released

Posted Apr 19, 2022 22:57 UTC (Tue) by newren (subscriber, #5160) [Link]

Part of the confusion may be the usage of the diff3 output format in the example, which is non-default and not everyone is used to. (If you don't have diff3 configured, remerge-diff won't use it in the output it shows.)

Also, looking at remerge-diff output for merges done by others tend to be harder to read than for merges you performed.

It can be understood this way: Basically, if you were to redo the merge of the two branches using 'git merge' now, and you run into conflicts, then git merge stop and point out that you need to resolve some issues. Resolving the conflicts will involve removing conflict markers, choosing which lines to keep, and possibly modifying some of those lines (and maybe even making other modification outside of the "conflict region"). The remerge-diff output is simply the changes from where 'git merge' would have stopped and told you to resolve things, and what got recorded in the commit. If it was a clean merge (and you didn't amend the merge commit), then the remerge-diff output will be empty.

diff --side-by-side v1.patch v2.patch

Posted Apr 20, 2022 21:49 UTC (Wed) by marcH (subscriber, #57642) [Link] (6 responses)

It's hurts to see more "collapsed axis diff" experimentation failing when this problem has already been solved for ages.

The generic problem is: how to compare diffs? While the final goal is different, it's a very similar problem to comparing v1 and v2 of a patch series (a.ka. "history of the history", git range-diff etc.) In both cases you have a common base and two "branches" that diverged from each other.

I've seen religious arguments between fans of the side-by-side (X axis) diff versus inline diff (Y axis) but for comparing diffs you obviously want to leverage BOTH dimensions instead of experimenting with various, all unreadable ways to collapse the two dimensions on a single axis using two columns and what not.

In other words: "diff --side-by-side v1.patch v2.patch" or "diff --side-by-side branch1.patch branch2.patch" and problem solved.

This is similar to the religious and pointless "command-line versus GUI?" debates; the answer is here "both of course". In fact I can easily imagine a connection between these two debates - graphical diff tools have been preferring side by side diffs since forever.

diff --side-by-side v1.patch v2.patch

Posted Apr 21, 2022 17:04 UTC (Thu) by newren (subscriber, #5160) [Link] (5 responses)

I can't tell what you're responding to in the Git 2.36 release notes. I re-read them now and can't find anything related to diffs of diffs, but perhaps I missed it. Could you point it out to me?

diff --side-by-side v1.patch v2.patch

Posted Apr 21, 2022 17:28 UTC (Thu) by mathstuf (subscriber, #69389) [Link] (4 responses)

`git range-diff` was released a while ago: https://git-scm.com/docs/git-range-diff

Still waiting on forges to adopt this command's output for rebased MRs…

diff --side-by-side v1.patch v2.patch

Posted Apr 21, 2022 17:59 UTC (Thu) by marcH (subscriber, #57642) [Link] (3 responses)

Gerrit completed the implementation of range-diff in April 2018 https://bugs.chromium.org/p/gerrit/issues/detail?id=217#c42
I think that was long before git itself had it.

More background in the Gitlab feature request https://gitlab.com/gitlab-org/gitlab/-/issues/24096

diff --side-by-side v1.patch v2.patch

Posted Apr 21, 2022 18:14 UTC (Thu) by newren (subscriber, #5160) [Link] (1 responses)

git merged range-diff in Aug 2018, and it appeared in Git 2.19: https://git.kernel.org/pub/scm/git/git.git/commit/?id=81e...

Also, the link you give for Gerrit seems to be for a single change. While you can do a range-diff for a single patch of a series, it's not quite the same thing. I did like the comparison of the current patch against older patchsets and used that in Gerrit, but I still I really would have liked something like range-diff in Gerrit back when I was still using it up to about 6 months ago. To my knowledge, it still doesn't exist in Gerrit.

Out of curiosity, was there something in the Git 2.36 release announcements that triggered this discussion about this feature from Git 2.19, or is this just an interesting tangent?

diff --side-by-side v1.patch v2.patch

Posted Apr 21, 2022 19:55 UTC (Thu) by mathstuf (subscriber, #69389) [Link]

> was there something in the Git 2.36 release announcements that triggered this discussion about this feature

The GP was comparing the diff rendering changes to diffs-of-diffs.

diff --side-by-side v1.patch v2.patch

Posted Apr 21, 2022 18:16 UTC (Thu) by mathstuf (subscriber, #69389) [Link]

Gerrit really needed it with the patch-oriented workflow. FWIW, ReviewBoard was also diffing diffs in the early 2010's.

> More background in the Gitlab feature request https://gitlab.com/gitlab-org/gitlab/-/issues/24096

Yeah, that's a visited link for me :) . One of my issues is even closed as a duplicate of this one.


Copyright © 2022, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds