microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.77k stars 28.73k forks source link

Source control view shows wrong changes when using VS Code as a diff tool from the git difftool command #55460

Closed Christian-Marx closed 6 years ago

Christian-Marx commented 6 years ago

Issue Type: Bug

This might be related to #55428.

Steps to reproduce:

$ git init
$ mkdir dir1
$ touch dir1/a
$ mkdir dir2
$ touch dir2/b
$ git add .
$ git commit -m"foo"
$ echo change > dir1/a
$ git difftool

The git difftool command is defined as:

code-insiders --wait --diff \"$LOCAL\" \"$REMOTE\"

When invoking git difftool, the source control view in VS Code will show wrong changes. It will...

screenshot4

I think the source control extension makes those assumptions based on a wrong base directory, as it has loaded dir1 as a source control provider.

VS Code version: Code - Insiders 1.26.0-insider (64c433bf2bd43c85d1bfe5753bb6fb90ff4be14a, 2018-07-30T05:19:32.584Z) OS version: Windows_NT x64 10.0.15063 git version 2.18.0.windows.1

vscodebot[bot] commented 6 years ago

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

isidorn commented 6 years ago

Duplicate, let's treat that all in one issue. Feel free to add more details in that one

Christian-Marx commented 6 years ago

I opened a separate issue because I wasn't sure if this was really a result of #55428. The bug I'm describing here is that a wrong base directory is picked up if changes are made in sub-folders, resulting in wrong changes in the source control view, whereas the other issue is about the $TEMP dir being picked up additionally as a source control provider. There might be a common source of error to both problems, but it looks like different problems to the user. That's why I opened a separate issue. What do you think?

isidorn commented 6 years ago

@Christian-Marx please add this comment to the other issue and once Joao is back from vacation he will triage and figure out what needs to be done here. Thanks a lot

Christian-Marx commented 6 years ago

Thanks, I'll add it there.