DESCRIPTION

[sync] Fix StackOverflowError and cache/working tree model

After change I137e703f Cache tree and Working tree model does not have
any containers because cached structure of tree cannot be build properly
based on IPath keys. Therefore I decided to revert part of this change
in case of working tree and cache tree models.

In previous implementation the StackOverflowError can occures when
repository contains a file without extension, now this should be also
fixed.

Change-Id: I46570795605aae9b77910281db8ce9760ce8e70d
Signed-off-by: Leslie Stephenson xxx@xxx.xxx


COMMENTS

author: Leslie Stephenson
date: 2011-01-30 15:19:22.000000000

Uploaded patch set 2.

-------------------------------------
author: Leslie Stephenson
date: 2011-01-30 15:19:44.000000000

Patch Set 2:

Fixed some typos in commit message

-------------------------------------
author: Zachary Orozco
date: 2011-01-31 07:19:50.000000000

Patch Set 2: I would prefer that you didn't submit this

(4 inline comments)



Line:65, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTree.java -> Same argument as in last file: you are only interested in the location of the last slash ... I guess indexOf+substring would be faster.

Line:184, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java -> isn't it faster to ask for path.indexOf('/')? We don't need all these substrings beeing created and we can stop after the first occurence.

Line:206, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java -> Is that correct? On a file 'a/b/c/f.txt' wont this path.split..[0] construct return only 'a' (instead of 'a/b/c' what I expect is what you want). Maybe its better to work with lastIndexOf('/') and substring().
lastSlash = path.lastIndexOf('/');
if (lastSlash>-1) pathKey = path.substring(0, lastSlash);

Line:215, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java -> path.substring(lastSlash+1) maybe better here.

-------------------------------------
author: Leslie Stephenson
date: 2011-01-31 09:01:02.000000000

Patch Set 2: (3 inline comments)



Line:65, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCacheTree.java -> Done

Line:206, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java -> Here we want to get a "root node" ('a' in yours example) to check it was already created or we should create it. Then we add a child to this node (child format is b/c/f.txt, and inside addChild() we do exactly the same.

Yes we can use here substring(0, indexOf("/")) instead of splitting.

Line:215, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java -> True, we can extract this value.

-------------------------------------
