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

The whole file is highlighted as modified #82

Closed
mmatrosov opened this issue Aug 21, 2015 · 9 comments
Closed

The whole file is highlighted as modified #82

mmatrosov opened this issue Aug 21, 2015 · 9 comments

Comments

@mmatrosov
Copy link

If a file has any changes, the whole file is highlighted as modified. The bug is reproduced with all other extensions disabled.

Visual C++ project, C++ file, Visual Studio 2015, Windows 10 x64 (same was under Windows 7 x64), GitDiffMargin v3.1.0.0.

git diff margin bug

@sharwell
Copy link
Collaborator

I've never seen anything like this. My guess is there's another extension which is changing the line endings of the file behind the scenes.

Off the top of my head I'm not quite sure how to debug this. Any ideas @laurentkempe?

@sharwell
Copy link
Collaborator

Actually, another possibility is the path to the file (including the file name) within the project file in Visual Studio differ from the file on disk by case only.

❓ Try restarting Visual Studio and opening this file without opening the solution (just open the file by itself in a fresh copy of Visual Studio. Does the problem still occur? If so, make sure that the path to the file on your drive (Windows is case-insensitive) matches the path to this file within the Git repository (which is case-sensitive), and try again.

@laurentkempe
Copy link
Owner

I was also thinking of the line endings. I currently do not have the C++ installed to try reproduce it, will try to install it to have a look

@mmatrosov
Copy link
Author

Ok, that's what I was able to find out:

  1. There is no interference with any other extensions: I disabled all of them
  2. There is no difference whether I open the file as a part of a solution or as an independent file
  3. The bug is reproduced in both Visual Studio 2013 and 2015. However, on Visual Studio 2013 on a different computer with the similar environment I do not experience this bug.
  4. If I change line endings from Windows style to Unix style, the bug disappears

So it seems like your guess was right in the spot!

@mattwarren
Copy link

I've had exactly the same problem, I only see the real diffs if I change the line ending from Windows to Unix style as @mmatrosov points out (File -> Advanced Save Options...).

The only difference I have is that I see this with a .cs project, not a .cpp one.

But is there a way to make GitDiffMargin work without doing this?

@laurentkempe
Copy link
Owner

@mattwarren Could it be your .gitattributes that set the file to Unix?

@mmatrosov
Copy link
Author

@laurentkempe Cool. As stated here, if I add .gitattributes file with the line * text=auto or execute a command git config --global core.autocrlf true, the issue is gone. Thank you for the hint!

@jwidar
Copy link

jwidar commented Mar 1, 2019

Hello.

I'm having this issue today 1 march 2019, using the newest version 3.9.2.42 updated automatically by Visual Studio 2017.

Microsoft Visual Studio Professional 2017
Version 15.9.7
VisualStudio.15.Release/15.9.7+28307.423
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Professional

image
The only line I have changed in the file is the one marked in orange.
According to git, only that line is changed:
image
I have seen it a few times recently, but cannot remember if it begun today or earlier.

@jwidar
Copy link

jwidar commented Mar 1, 2019

@laurentkempe
I got rid of the problem mentioned above by reverting to v3.9.0
If I install the one labeled security fix, the problem comes back.

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

No branches or pull requests

5 participants