添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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

Issue Type: Bug

Searched "diff does not match command line " and didn't find any issues for this.
Was actually using insiders v1.31.0-insiders and encountered this error. Also happening on my current version.

Files are changed, but when I click certain changed files in vscode's source control sidebar, I see no changes. I checked command line git diff and noticed that there actually are important changes here.

I suggest starting reading down at: #65326 (comment) - Or at least skipping the preamble/repro. Turns out I did not need to include all the information I did.

Preamble/repro

I was going about my day, made some commits... did a git pull... hit a merge conflict.. it automatically aborted for some reason.. I fixed my code so there wouldn't even be a merge conflict, then pulled again, got distracted cleaning up some console.logs, but I undid those changes and saved them in a google doc.

I noticed I had a css file changed (presumably merge conflict, but doesn't seem to be the case here), so I did a sass compile force update to make sure I write the latest css (I can't believe we check compiled sass into git but that's just how it is).

The css file could have changed after the merge, since I have a watcher running.

Bottom line is, this is my git status:

ip ➤ git status                                                                                               git:master*
On branch master
Your branch is ahead of 'origin/master' by 4 commits.
  (use "git push" to publish your local commits)
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
	modified:   course1/models/mod2/assets/mod2.css
	modified:   course1/models/mod2/assets/mod2.css.map
	modified:   course1/models/old2/assets/mod2.css
no changes added to commit (use "git add" and/or "git commit -a")

Git diff shows changes to the first mod2.css file (mod2/assets/mod2.css), but when I click the file in vscode, I don't see anything:

-.clearfix {
-  *zoom: 1; }
-.clearfix:before, .clearfix:after {
-  content: '';
-  display: table; }
-.clearfix:after {
-  clear: both; }
-#shell-content {
-  padding-top: 0px !important; }
-.adobe-red-darkened-background {
-  background-color: #861216; }
-.adobe-red-darkened-background-disabled {
-  background-color: #2c0607; }
-.mod2-container {
-  opacity: 0.1;
-  transition: opacity 1s;
-  box-shadow: 0 0 320px 1px inset black;
-  background-image: url(../../../../course1/content/mod2/img/full-bg.png);
-  background-repeat: no-repeat;
-  background-position: center top;
-  background-size: auto;
-  min-height: 961px; }
-.dragdrop .col {
-  width: 48%;
-  height: auto; }
-  .dragdrop .col.left {
-    float: left; }
-  .dragdrop .col.right {
-    float: right; }
-.dragdrop hr.vertical {
-  width: 1px;
-  height: 440px;
-  position: absolute;
-  top: 45px;
-  left: calc(50% - 1px);
-  background-color: #b927b9;
-  border: none; }
-/*# sourceMappingURL=mod2.css.map */
+.clearfix {
+  *zoom: 1; }
+.clearfix:before, .clearfix:after {
+  content: '';
+  display: table; }
+.clearfix:after {
+  clear: both; }
+#shell-content {
+  padding-top: 0px !important; }
+.adobe-red-darkened-background {
+  background-color: #861216; }
+.adobe-red-darkened-background-disabled {
+  background-color: #2c0607; }
+.mod2-container {
+  opacity: 0.1;
+  transition: opacity 1s;
+  box-shadow: 0 0 320px 1px inset black;
+  background-image: url(../../../../course1/content/mod2/img/full-bg.png);
+  background-repeat: no-repeat;
+  background-position: center top;
+  background-size: auto;
+  min-height: 961px; }
+.dragdrop .col {
+  width: 48%;
+  height: auto; }
+  .dragdrop .col.left {
+    float: left; }
+  .dragdrop .col.right {
+    float: right; }
+.dragdrop hr.vertical {
+  width: 1px;
+  height: 440px;
+  position: absolute;
+  top: 45px;
+  left: calc(50% - 1px);
+  background-color: #b927b9;
+  border: none; }
+/*# sourceMappingURL=mod2.css.map */

Side note - I do push to a hg remote, via git-remote-hg, so maybe there's an issue related to that (maybe vscode reads some things from .git folder that are different because of git-remote-hg, although I doubt git-remote-hg changes the .git folder in any serious or related way).

VS Code version: Code 1.30.1 (dea8705, 2018-12-18T18:05:00.654Z)
OS version: Darwin x64 17.7.0

System Info Value GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled Load (avg) 2, 2, 3 Memory (System) 16.00GB (7.66GB free) Process Argv Screen Reader
Extensions (17) Extension Author (truncated) Version

Going to try without extensions in a sec...
Here is a screenshot of vscode just for proof:

It looks like the file in vscode is the current one on disk, which is different from what I had previously.

Not a critical issue for me, since I know how to use the command line.

Ran with extensions disabled and issue is still present. The black thing in the line number gutter is gone, of course, since that's an image preview from some extension.

The mod2.css.map file also shows no changes, but the old2/assets/mod2.css file does show these changes, which do match the output of cli git diff:

I'm pretty sure this was all identical in insiders build - just these few lines were shown as insertions in vscode.

In the insiders build, I tried clicking "toggle side by side" and selected the new code, and tried "stage selection" but neither did anything.

Tried "Developer: Show logs.." and "Developer: Open Webview Developer Tools" but neither of these worked. All the basic functions seem to still work, though.

In the git diff file view, clicking "Open file" in the top right shows the file, but there's no green/red line change in the left gutter.

I can't use the "Stage Selected Range" regardless of what I select. (for mod2/assets/mod2.css)
I can click the plus in the sidebar to successfully stage the file. Git reflects this too.

The explanation is:

  • we have our own diff algorithm that we use even when you use a different source control provider (i.e. when git is not installed)
  • the diff editor does not render changed lines endings. i.e. CRLF vs LF
  •