Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDariusz Luksza2011-02-08 18:54:21 -0500
committerMatthias Sohn2011-02-08 18:54:21 -0500
commit0b71c1ab1cf65b06342dc266c8d6749133671a42 (patch)
treedcbf24d57a8b20b1a972bffdb156429a6dd273f7
parentc563d5161304f968b577f28577a103deeb25194d (diff)
downloadegit-0b71c1ab1cf65b06342dc266c8d6749133671a42.tar.gz
egit-0b71c1ab1cf65b06342dc266c8d6749133671a42.tar.xz
egit-0b71c1ab1cf65b06342dc266c8d6749133671a42.zip
[sync] Fix newly created files in 'working tree' node
Newly created files were not included in 'working tree' node because the DirCacheIterator was not found in TreeWalk instance. It also appears that we don't need to have instance of DirCacheIterator to get list of children in GitModelWorkingTree and GitModelCache. Bug: 336663 Change-Id: Ide3c9096e7c3a0c7cf80519dc023bbe03a8cd56e Signed-off-by: Dariusz Luksza <dariusz@luksza.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java19
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTree.java2
2 files changed, 2 insertions, 19 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java
index 6b445e4a5..6523c2376 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelCache.java
@@ -23,7 +23,6 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIText;
import org.eclipse.jgit.dircache.DirCache;
-import org.eclipse.jgit.dircache.DirCacheEntry;
import org.eclipse.jgit.dircache.DirCacheIterator;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -37,11 +36,6 @@ import org.eclipse.jgit.treewalk.TreeWalk;
*/
public class GitModelCache extends GitModelObjectContainer {
- /**
- * NTH of {@link DirCacheIterator}
- */
- protected int dirCacheIteratorNth;
-
private final Path location;
private final FileModelFactory fileFactory;
@@ -146,8 +140,7 @@ public class GitModelCache extends GitModelObjectContainer {
* Creates and configures {@link TreeWalk} instance for
* {@link GitModelCache#getChildrenImpl()} method. It is IMPORTANT to add
* tree that will be used as a base as first, remote tree should be added as
- * second; {@link GitModelCache#dirCacheIteratorNth} should be set with
- * value of NTH that corresponds with {@link DirCacheIterator}.
+ * second;
*
* @return configured instance of TreeW
* @throws IOException
@@ -161,21 +154,11 @@ public class GitModelCache extends GitModelObjectContainer {
ObjectId headId = repo.getRef(Constants.HEAD).getObjectId();
tw.addTree(new RevWalk(repo).parseTree(headId));
tw.addTree(new DirCacheIterator(index));
- dirCacheIteratorNth = 1;
return tw;
}
private GitModelObject extractFromCache(TreeWalk tw) throws IOException {
- DirCacheIterator cacheIterator = tw.getTree(dirCacheIteratorNth,
- DirCacheIterator.class);
- if (cacheIterator == null)
- return null;
-
- DirCacheEntry cacheEntry = cacheIterator.getDirCacheEntry();
- if (cacheEntry == null)
- return null;
-
if (shouldIncludeEntry(tw)) {
String path = tw.getPathString();
ObjectId repoId = tw.getObjectId(BASE_NTH);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTree.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTree.java
index ea55f426b..7bea8e947 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTree.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/model/GitModelWorkingTree.java
@@ -57,8 +57,8 @@ public class GitModelWorkingTree extends GitModelCache {
tw.setRecursive(true);
Repository repo = getRepository();
- dirCacheIteratorNth = tw.addTree(new DirCacheIterator(repo.readDirCache()));
int ftIndex = tw.addTree(new FileTreeIterator(repo));
+ int dirCacheIteratorNth = tw.addTree(new DirCacheIterator(repo.readDirCache()));
IndexDiffFilter idf = new IndexDiffFilter(dirCacheIteratorNth, ftIndex, true);
tw.setFilter(idf);

Back to the top