laurentkempe / GitDiffMargin

Git Diff Margin displays live Git changes of the currently edited file on Visual Studio margin and scroll bar. Supports Visual Studio 2012 through Visual Studio 2022
https://marketplace.visualstudio.com/items?itemName=LaurentKempe.GitDiffMargin
MIT License
290 stars 39 forks source link

VS2022, GitDiffMargin indicator wrongly shows a change, but VS2022 diff margin correctly shows an addition. #775

Open TheGreatUnboxing opened 5 months ago

TheGreatUnboxing commented 5 months ago

Versions

What happened

Have been using git diff margin exclusively for years, however it has often shown changes when there are additions. I thought this might be because of the current diff algorythm being used, so in bash I entered this to make sure:

git config --global diff.algorithm patience

Nothing changed upon restart, however Sublime Merge does show (correctly) an addition of a block of c# code where Git Diff Margin (incorrectly) shows it as a change. e.g:

image

image

I'm wondering if perhaps Git Diff Margin is looking at a different Git install to the one VS is looking at? Or one looking at a 32bit install and the other a 64 bit install? However I don't know how to determine that. My last Git 64bit update installed into C:\Program Files\Git\

Expected behavior

GitDiffMargin displays the same diff margin indicators as VS 2022 track changes (Git) margin.

ed: This may not be a bug, may be a configuration issue but I can't find any settings in Tools -> Options specifically for GitDiffMargin

ed2: I ran git config --global diff.algorithm patience in both Git folders I can find:

  1. C:\Program Files\Git\bin
  2. C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw64\bin\

However the results are the same as above.

sharwell commented 4 months ago

For the change above, was there a whitespace change on line 1337?

Note that Git Diff Margin is showing exactly the same result as Sublime Merge here. A "change" is defined as one or more lines removed followed by one or more lines added.

TheGreatUnboxing commented 4 months ago

For the change above, was there a whitespace change on line 1337?

No, I did check to make sure there was no whitespace on the blank line there.

Note that Git Diff Margin is showing exactly the same result as Sublime Merge here. A "change" is defined as one or more lines removed followed by one or more lines added.

True, but both seem incorrect to me, whereas VS 2022 is correct in terms of the actual changes made.

Ed: As sublime merge agrees with GDM, I was wondering if VS was looking at different diff settings, but tried changing the diff algo in Git and in SM's options, but nothing changed. Perhaps VS is doing some extra black-box magic on top but was hoping to get the same results from GDM (I prefer its margin UI for one)