pombreda / nbgit

Automatically exported from code.google.com/p/nbgit
0 stars 0 forks source link

"Removing ..." action eats 100% CPU regularly #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Open any file in any project under git, you'll see in the staus bar
"Removing..." that usually takes about 30-40 secons eating up CPU a lot. 

What versions of NbGit, NetBeans and Java are you using?
Latest master branch from github repo. JDK 1.6.

On what operating system?
Windows.

Please provide any additional information below.
I've traced these slowdowns to GitInterceptor.fileDeletedImpl(), which does
FULL REFRESH of the repo on every delete, even when in my case all that was
deleted is a temp file in M:\Temp directory. :)

It looks like JGit creates a temp file and then deletes it, the NBGit gets
the notification about the deletion and refreshes the whole repo, not
checking that the deleted file was *outside* of the repo.

I fixed this on my side with (stupid, but simple and workable for me) patch. :)

diff --git a/src/org/nbgit/GitInterceptor.java
b/src/org/nbgit/GitInterceptor.java
index 43e73e1..ac582ea 100644
--- a/src/org/nbgit/GitInterceptor.java
+++ b/src/org/nbgit/GitInterceptor.java
@@ -111,7 +111,7 @@ public void run() {
     }

     private void fileDeletedImpl(final File file) {
-        if (file == null || !file.exists()) {
+        if (file == null || !file.exists() ||
file.getPath().startsWith("M:\\Temp\\")) {
             return;
         }
         Git git = Git.getInstance();

Original issue reported on code.google.com by vsizi...@gmail.com on 10 Nov 2009 at 11:45

GoogleCodeExporter commented 9 years ago
Great thanks for tracking this down. It might be related to issue 40.

Original comment by jonas.fonseca on 10 Nov 2009 at 1:31

GoogleCodeExporter commented 9 years ago

Original comment by jonas.fonseca on 10 Nov 2009 at 1:32