Skip to content

After update to v3.9.1.37, “Show the diff” feature is unusable (VS 2017) #192

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

Closed
HamRusTal opened this issue Feb 26, 2019 · 13 comments
Closed

Comments

@HamRusTal
Copy link

I was using v3.9.0.0 in VS 15.9.7 (configured for C++ development) and everything worked great (thanks!).
Yesterday, VS auto-updated Git-related extensions (GitHub and GitDiffMargin), and after that whenever I open the Diff from GitDiffMargin's pop-up Actions menu, it shows as if the original file is empty and the entire text is added anew (both for C# and C++ projects). VS's built-in Diff (opened from Team Explorer - Changes) works fine as before. Uninstalling and reinstalling GitDiffMargin does not help.

@laurentkempe
Copy link
Owner

Thanks @HamRusTal to report that, I htink I just reproduced that this morning on my machine!

image

I will have a look asap, hopefully this evening!

@HamRusTal
Copy link
Author

just reproduced that this morning on my machine!

Great!

I will have a look asap, hopefully this evening!

Looking forward to your findings!

P.S.
Is this screenshot from VS 2019? In VS 2017, I don't have the vertical scrollbar in the left pane. Or is it the language (C#) that makes the difference?

@laurentkempe
Copy link
Owner

Is this screenshot from VS 2019? In VS 2017, I don't have the vertical scrollbar in the left pane. Or is it the language (C#) that makes the difference?

Yeah it is VS 2019

@HamRusTal
Copy link
Author

HamRusTal commented Feb 27, 2019

In the meantime, is there any API in the Visual Studio for the extension to open exactly the Git Diff window/pane which opens from “Team Explorer - Changes”?
Why:

  1. It has a nicer looking tab name (e.g. “Diff - MyFile.cpp;HEAD vs. MyFile.cpp”).
  2. It handles encoding properly (e.g. try diffing UTF-8-encoded file containing Chinese characters).
  3. Also, I noticed that GitDiffMargin was diffing against a wrong “version” in a somewhat convoluted set-up (I'll report separately once I can reproduce it reliably).

@laurentkempe
Copy link
Owner

I identified the issue but I cannot make sense of it!
The issue is that relativepath on this line of GitCommands is of the form "path\file.cs" and the indexer is having file indexed with "path/file.cs" so changing the code to var indexEntry = repo.Index[relativePath.Replace("\\", "/")]; fix it.

What makes no sense to me is that this GitDiffMargin code didn't change since last release and looking at the code of LibGit2Sharp it is the same!
@jcansdale any idea? or @ethomson

@laurentkempe
Copy link
Owner

In the meantime, is there any API in the Visual Studio for the extension to open exactly the Git Diff window/pane which opens from “Team Explorer - Changes”?

Pls @HamRusTal open an other issue so that we do mix topics, thx

@ethomson
Copy link

LibGit2Sharp did change its behavior at some point, but I don't remember when. (Many years ago.) If you moved from a very old version to something more recent then that could indefed be the culprit.

@laurentkempe
Copy link
Owner

Thanks for the super fast answer @ethomson
I moved from v0.24.1 from Mar 12, 2018 to https://github.com/libgit2/libgit2sharp/releases/tag/v0.26 from 13 days ago!
I looked at the LibGit2Sharp code and it seems that nothing changed in that area since at least two years!

@ethomson
Copy link

Yes, I'm also surprised by this.

@HamRusTal
Copy link
Author

HamRusTal commented Feb 27, 2019

open an other issue so that we do mix topics, thx

@laurentkempe Why I asked this here is because if there is such an API, it might make sense to use that instead of fixing your own implementation of the same functionality (which is not quite on par yet).

@laurentkempe
Copy link
Owner

@HamRusTal We are using the same VS API to show the diff and it is those are the same windows

See at the top the one from Changes and at the bottom the one from GitDiffMargin
image

  1. It has a nicer looking tab name (e.g. “Diff - MyFile.cpp;HEAD vs. MyFile.cpp”).
    The name is different because we build our own caption!

2. It handles encoding properly (e.g. try diffing UTF-8-encoded file containing Chinese characters).
It is true that there is from time to time an encoding issue when used through GitDiffMargin, this I have seen myself!

3. Also, I noticed that GitDiffMargin was diffing against a wrong “version” in a somewhat convoluted set-up (I'll report separately once I can reproduce it reliably).
I am looking forward to see your issue report cause I never have seen that myself

@HamRusTal
Copy link
Author

We are using the same VS API to show the diff and it is those are the same windows

Great! I'll file the issues separately (sooner or later).

laurentkempe added a commit that referenced this issue Feb 28, 2019
@HamRusTal
Copy link
Author

It works as before now, thank you!

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

3 participants