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

🚀 Is there anything to properly preview git's combined diff output ? #736

Closed
akharrou opened this issue Oct 15, 2021 · 3 comments · Fixed by #812
Closed

🚀 Is there anything to properly preview git's combined diff output ? #736

akharrou opened this issue Oct 15, 2021 · 3 comments · Fixed by #812

Comments

@akharrou
Copy link

akharrou commented Oct 15, 2021

Thank you for this amazing diff render I really love it and use it ALL the time

Currently, with my configurations at least, the "combined diff" output that git produces for unmerged files is interpreted like any other regular diff output.

# combined diff example (currently have files in an unmerged state)
$ git diff
diff --cc file.txt
index 1191247,e2709b3..0000000
--- i/file.txt
+++ w/file.txt
@@@ -1,2 -1,2 +1,7 @@@
  1
++<<<<<<< .merge_file_ehjgho
 +2
++||||||| .merge_file_r2aEcC
++=======
+ 102
++>>>>>>> .merge_file_VIgoDD

Lines with:

  • " ": are already present on both "ours" and "theirs" copy
  • "+ ": are additions to "ours"
  • " +": are additions to "theirs"
  • "++": are additions to both "ours" and "theirs"
  • ... ditto for subtractions

Currently I get this delta output for combined diffs:

image

It's not wrong, you can still interpret the first column yourself. my question is: is there currently a way of interpreting combined diffs ? otherwise my feature suggestion would be: maybe it would be a nice addition to delta if it could be passed an option or somehow detect that the output is a combined diff output (e.g. maybe the first line of the diff output diff --cc ... gives it away) and highlight in a certain way for additions to "ours", in another for additions to "theirs" and another for additions to both, etc.

@dandavison
Copy link
Owner

Hi @akharrou, thanks for this, it doesn't exist yet but I absolutely agree -- I'd love to see this tackled. There are a couple of related issues: #189 and #609, but yours gives good discussion of merge conflict markers. If anyone would like to start making progress in this area that would be very welcome.

dandavison added a commit that referenced this issue Nov 30, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Nov 30, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Nov 30, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 3, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 4, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
@dandavison
Copy link
Owner

@akharrou I've made a start on this. It would be great to have your feedback/thoughts. If you're interested, let's discuss in this issue: #189 (comment)

Screenshots from #189 copied below:

The merge conflict handling is particularly intended for users who have set merge.conflictstyle = diff3: it diffs the ancestral commit against the two derived commits in turn. I'm not sure how merge conflicts should be styled and welcome suggestions!

image

Combined diff handling looks like this (note the 2-char-wide prefixes):

image

dandavison added a commit that referenced this issue Dec 4, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 4, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 4, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 4, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 4, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 5, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 5, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
dandavison added a commit that referenced this issue Dec 5, 2021
With this commit combined diff
format (https://git-scm.com/docs/git-diff#_combined_diff_format) is
handled appropriately. However, there is no special handling of merge
conflict markers.

Fixes #189, #736
@dandavison
Copy link
Owner

Initial handling of combined diff, and merge conflicts, has been implemented in #812. I'll release it soon; if anyone's able to test (on master) that would be fantastic.

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 a pull request may close this issue.

2 participants