Closed Rochet2 closed 5 years ago
(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
On step (6):
You should now have committed the file. but you still have the diff open.
As soon as you commit, in at most 10 seconds, the diff should update to adjust for the commit, eventually showing no changes. Does it not?
Are file events working at all in your Code?
As soon as you commit, in at most 10 seconds, the diff should update to adjust for the commit, eventually showing no changes. Does it not?
It does not. I tested on another machine that uses windows instead of ubuntu and it seemed to work as expected and updated the diff view immediately. On the ubuntu machine that is not the case.
Are file events working at all in your Code?
As I tried testing the reproduction case again now, the changes I made in the editor at first were updated to the Source Control so that the file automatically showed up as changed and I could click it to view the diff. After that as I commit the file the diff does not change.
After this I tried to restart VS Code and now even the changes I do to the file do not show up in the Source Control. So it seems as if file events were working, but after the commit I made just now they no longer do - even after restart of VS code. The changes to files in Explorer view such as 'unsaved' status do show up. I would guess that version control events (such as changes to files) are broken.
I have used this workaround to work on a large monorepo before: https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc However reverting it did not help with the issue.
In this gif you can see my current attempt to reproduce the bug.
If you run Developer: Toggle Developer Tools
, are there any errors in the console?
Did you open the git repo root folder in Code, or a subfolder of it?
I just pushed a fix for https://github.com/Microsoft/vscode/issues/41085 which might be the underlying issue. Give it another go tomorrow on the Insiders version and let me know how it goes.
Did you open the git repo root folder in Code, or a subfolder of it?
The issue occurs when opening the root folder that contains .git
folder. The gif above was taken by opening the root folder in Code.
When working I open a subfolder and have the same issue though.
If you run
Developer: Toggle Developer Tools
, are there any errors in the console?
I get the following error:
workbench.main.js:3313 [Extension Host] debugger listening on port 64972
workbench.main.js:1406 ERR Error: Error: ENOENT: no such file or directory, stat '/home/rimi/Documents/oodikone/repro/.vscode'
when using
Version: 1.35.0
Commit: 553cfb2c2205db5f15f3ee8395bbd5cf066d357d
Date: 2019-06-04T01:13:26.790Z
Electron: 3.1.8
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.15.0-51-generic
Give it another go tomorrow on the Insiders version and let me know how it goes.
I will test earliest on next monday as I am away from the machine with the problem for a few days.
Let me know once you test Insiders.
On
Version: 1.36.0-insider
Commit: 11b88a3323878a98b418e4efca77e7afabd50d01
Date: 2019-06-17T05:15:27.899Z
Electron: 4.2.4
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Linux x64 4.15.0-51-generic
it seems that the behavior is now as you described. So after committing, the diff view will then update with the correct changes.
It seems that the changes in the file itself still does not update to the source control view. However, editing the file in the diff view does update the source control view. That is probably a separate issue and related to some kind of file events not working maybe.
I still have the same error in the debug console:
[Extension Host] debugger listening on port 19793
log.ts:173 ERR Error: Error: ENOENT: no such file or directory, stat '/home/rimi/Documents/oodikone/repro/.vscode'
That error is not related to the issue.
So... is it working in Insiders? What is not working in Insiders?
Version: 1.36.0-insider
Working:
Not working:
So the issue of old changes in diff is solved.
editing a file directly does not update Source Control panel to have the changed file (must manually press refresh button)
Are you saving the file after editing? Are you waiting at least 10 seconds?
I do save the file. I do wait at least 10 seconds.
Here is a gif where I edit the file (4th row from ffff
to eeee
), save it (CTRL+S), wait 30 seconds and nothing happens. Then I press the Source Control refresh button and the file appears there.
This is still on the same 1.36.0-insider version.
Do you get file events at all? IE: if you create a file in the terminal, does the file appear in the file explorer?
When I create a new file in a terminal, the new file appears in file explorer. The file does not appear in Source Control. Here is a gif of exactly that: In this gif I first show how there is no test2.txt and there are no changes in Source Control. Then I create test2.txt file and it appears to the file explorer automatically instantly, but it does not appear to Source Control.
Can you show me the full output of Git: Show Git Output
?
Looking for git in: git
Using git 2.17.1 from git
> git rev-parse --show-toplevel
> git rev-parse --git-dir
> git config --get commit.template
Open repository: /home/local/rimi/Documents/oodikone/repro
> git rev-parse --show-toplevel
> git status -z -u
> git rev-parse --show-toplevel
> git symbolic-ref --short HEAD
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
> git check-ignore -v -z --stdin
> git checkout -q -- /home/local/rimi/Documents/oodikone/repro/test.txt
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
For the log below I restarted Code insiders, opened the log and then created test2.txt file. The result was that there was no changes in the git log at all. All of the log was created at starting of Code insiders. So when creating the file there was no git output created. Here is the log:
Looking for git in: git
Using git 2.17.1 from git
> git rev-parse --show-toplevel
> git rev-parse --git-dir
> git config --get commit.template
Open repository: /home/local/rimi/Documents/oodikone/repro
> git rev-parse --show-toplevel
> git status -z -u
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git symbolic-ref --short HEAD
> git rev-parse --show-toplevel
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
> git check-ignore -v -z --stdin
Can you show me your full settings?
I should have default settings after installing Code insiders. I am not sure how to show you the settings. These are the only 2 json files I found related to settings.
I also found a setting that seemed to show modified settings only. Here is an image of the modified settings: Workspace tab had no changed settings.
Here is User/settings.json:
{
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue"
}
Here is defaultSettings.json:
Can you also show me a GIF of
diff now updates after committing (was broken before)
Sorry for asking so much detail. I'm finding it hard to understand what could go wrong...
Here is a gif where I edit the file, refresh source control, click on the file in source control to view the diff, stage the changes, click on the staged file (since the diff was updated to not show the changes anymore), commit the file (and again the diff is updated to not show the old changes anymore). So that is working as expected.
In https://github.com/microsoft/vscode/issues/74889#issuecomment-499811465 you can see the diff not updating. So the updating was fixed.
And to be clear, it was fixed between 1.35.0-insider 553cfb2 and 1.36.0-insider 11b88a3
Alright, pushed https://github.com/microsoft/vscode/commit/997e91421e9490a11ff3b69dd285b2c175efbe46
Once you get tomorrow's build, which contains this commit, let's do the following:
1) Run Developer: Set Log Level...
and change it to Debug
2) Run Git: Show Git Output
3) Repeat the test
The code will start printing out file events to the output channel. I wanna know if you get them at all.
The log after opening VS code:
Looking for git in: git
Using git 2.17.1 from git
> git rev-parse --show-toplevel
> git rev-parse --git-dir
> git config --get commit.template
Open repository: /home/local/rimi/Documents/oodikone/repro
> git rev-parse --show-toplevel
> git status -z -u
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git symbolic-ref --short HEAD
> git rev-parse --show-toplevel
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
Same log persists as I set the loglevel to debug. As I add files to the folder, I get no additional log. The files show up in Explorer, but not in Source Control. When I edit a file (new one or already tracked by git .. any file) then there is still no additional log. As I save changes there is still no additional log. If I then delete any or all of the files (tracked, not tracked, saved, not saved) there is no new log generated.
Here is a full log from when I reproduce the steps from https://github.com/microsoft/vscode/issues/74889#issuecomment-503973858
Summary: nothing generated new log except doing actions in Source Control such as pressing Refresh, committing, staging ...
I tested this on
After switching to Debug level, does touch .git/index
show any output?
After switching to Debug level, does
touch .git/index
show any output?
Looking for git in: git
Using git 2.17.1 from git
> git rev-parse --show-toplevel
> git rev-parse --git-dir
> git config --get commit.template
Open repository: /home/local/rimi/Documents/oodikone/repro
> git rev-parse --show-toplevel
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git rev-parse --show-toplevel
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
--- Right after executing touch .git/index
[debug] [.git] Change: /home/local/rimi/Documents/oodikone/repro/.git/index
> git rev-parse --show-toplevel
--- After a second or two later:
> git status -z -u
> git symbolic-ref --short HEAD
> git rev-parse master
> git rev-parse --symbolic-full-name master@{u}
fatal: no upstream configured for branch 'master'
> git for-each-ref --format %(refname) %(objectname) --sort -committerdate
> git remote --verbose
Alright we're getting events. Is there anything special at all about your repository? Are you using symlinks? Network shares?
No. I have no symlinks or network shares in the repository. As I show in the main post, the only file in the repository is the test.txt and I only use git init, git add and git commit.
Can you get other [debug]
events in the log? Maybe as you touch other files inside and outside of .git
.
I tried touch test.txt
and got nothing. Tried touch .git/index
and got [debug] [.git] Change: /home/local/rimi/Documents/oodikone/repro/.git/index
So no log from touching files outside of .git
EDIT: Also, as previously said in https://github.com/microsoft/vscode/issues/74889#issuecomment-505371955 there is no log from editing, adding or deleting files either.
What about other files in .git
?
Inside .git
touching files and folders in the root of it triggered a debug message.
Touching anything inside the folders did not trigger anything.
Here is a log of my actions and of the output in Code:
Any chance you can clone VS Code and run it out of dev? https://github.com/microsoft/vscode/wiki/How-to-Contribute
If so, let's try to repro there. If it still repros, let's start putting traces in the right places. Let me know if you can get it to run, should be straightforward.
Alright. I got it installed and running. When trying to edit the test.txt I get no changes in Source Control and there is no [debug] events (so no file events still in the dev build).
I got some installation errors when running yarn
to 'install and build all dependencies', but when running it again everything passed. You can see a log of my installation process here: https://gist.github.com/Rochet2/6e78c47c753a747d02b655a0499f2edd after which I ran yarn watch
and started vscode with ./scripts/code.sh
successfully.
Awesome. Let's try this:
diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts
index a581f9f5fd..691ee7bcf5 100644
--- a/extensions/git/src/repository.ts
+++ b/extensions/git/src/repository.ts
@@ -648,6 +648,7 @@ export class Repository implements Disposable {
this.disposables.push(workspaceWatcher);
const onWorkspaceFileChange = anyEvent(workspaceWatcher.onDidChange, workspaceWatcher.onDidCreate, workspaceWatcher.onDidDelete);
+ onWorkspaceFileChange(e => console.log(e));
const onWorkspaceRepositoryFileChange = filterEvent(onWorkspaceFileChange, uri => isDescendant(repository.root, uri.fsPath));
const onWorkspaceWorkingTreeFileChange = filterEvent(onWorkspaceRepositoryFileChange, uri => !/\/\.git($|\/)/.test(uri.path));
Then, running out of dev, show the Console in the Developer Tools and see if something pops up as you edit a file.
When I edit a file I get nothing. But when I save the edits I get the following:
[Extension Host]% {
$mid: 1,
fsPath: "/home/rimi/Documents/oodikone/repro/test.txt",
external: "file:///home/rimi/Documents/oodikone/repro/test.txt",
path: "/home/rimi/Documents/oodikone/repro/test.txt",
scheme: "file"}
__proto__: Object
(at constructor.e (/home/local/rimi/vscode/extensions/git/out/repository.js:445:44))
When I edit a file I get nothing. But when I save the edits I get the following:
And when you save the edits... do the [debug]
logs come up (after setting log level to debug)?
The log I posted in previous reply is all I get. Here is a gif to show everything I do:
Am I missing something?
Cool. Let's try this now, same steps:
diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts
index a581f9f5fd..756ffcb5af 100644
--- a/extensions/git/src/repository.ts
+++ b/extensions/git/src/repository.ts
@@ -648,6 +648,14 @@ export class Repository implements Disposable {
this.disposables.push(workspaceWatcher);
const onWorkspaceFileChange = anyEvent(workspaceWatcher.onDidChange, workspaceWatcher.onDidCreate, workspaceWatcher.onDidDelete);
+
+ console.log(repository.root);
+ onWorkspaceFileChange(uri => {
+ console.log(uri);
+ console.log('isDescendant', isDescendant(repository.root, uri.fsPath));
+ console.log('passes filter', !/\/\.git($|\/)/.test(uri.path));
+ });
+
const onWorkspaceRepositoryFileChange = filterEvent(onWorkspaceFileChange, uri => isDescendant(repository.root, uri.fsPath));
const onWorkspaceWorkingTreeFileChange = filterEvent(onWorkspaceRepositoryFileChange, uri => !/\/\.git($|\/)/.test(uri.path));
With the new changes I now get this:
[Extension Host]% {$mid: 1, fsPath: "/home/rimi/Documents/oodikone/repro/test.txt", external: "file:///home/rimi/Documents/oodikone/repro/test.txt", path: "/home/rimi/Documents/oodikone/repro/test.txt", scheme: "file"} (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:447:21))
console.ts:134 [Extension Host] isDescendant false (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:448:21))
console.ts:134 [Extension Host] passes filter true (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:449:21))
Hmm, looks to me as if console.log(uri);
does not log anything at all.
It does, that's the first line in your output. One more:
diff --git a/extensions/git/src/repository.ts b/extensions/git/src/repository.ts
index a581f9f5fd..58e0fbd16a 100644
--- a/extensions/git/src/repository.ts
+++ b/extensions/git/src/repository.ts
@@ -648,6 +648,16 @@ export class Repository implements Disposable {
this.disposables.push(workspaceWatcher);
const onWorkspaceFileChange = anyEvent(workspaceWatcher.onDidChange, workspaceWatcher.onDidCreate, workspaceWatcher.onDidDelete);
+
+ console.log(repository.root);
+ onWorkspaceFileChange(uri => {
+ console.log(uri);
+ console.log(repository.root);
+ console.log(uri.fsPath);
+ console.log('isDescendant', isDescendant(repository.root, uri.fsPath));
+ console.log('passes filter', !/\/\.git($|\/)/.test(uri.path));
+ });
+
const onWorkspaceRepositoryFileChange = filterEvent(onWorkspaceFileChange, uri => isDescendant(repository.root, uri.fsPath));
const onWorkspaceWorkingTreeFileChange = filterEvent(onWorkspaceRepositoryFileChange, uri => !/\/\.git($|\/)/.test(uri.path));
The following is printed:
[Extension Host]% {$mid: 1, fsPath: "/home/rimi/Documents/oodikone/repro/test.txt", external: "file:///home/rimi/Documents/oodikone/repro/test.txt", path: "/home/rimi/Documents/oodikone/repro/test.txt", scheme: "file"} (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:447:21))
console.ts:134 [Extension Host] /home/local/rimi/Documents/oodikone/repro (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:448:21))
console.ts:134 [Extension Host] /home/rimi/Documents/oodikone/repro/test.txt (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:449:21))
console.ts:134 [Extension Host] isDescendant false (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:450:21))
console.ts:134 [Extension Host] passes filter true (at constructor.uri (/home/local/rimi/vscode/extensions/git/out/repository.js:451:21))
Alright.
Are you sure there are no symlinks in your setup? It sure looks like /home/local/rimi
and /home/rimi
are the same folder.
It sure looks like
/home/local/rimi
and/home/rimi
are the same folder.
That is indeed the case. /home/rimi
points to /home/local/rimi
.
That was painful to go through. Duplicate of #5970.
Also tested latest insider build:
Steps to Reproduce:
Does this issue occur when all extensions are disabled?: Yes