Browse Source

IndexDiff: Simplify allocation of filter list

We add either 3 or 4 filters.  If we are adding only 3 filters,
allocating the array for 4 isn't a huge waste of memory, but it
does simplify our code.

Change-Id: I7df29b414f6d5cfcf533edb1405083e6fcec32cf
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.10
Shawn O. Pearce 14 years ago
parent
commit
f4e9c8890c
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java

3
org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java

@ -177,8 +177,7 @@ public class IndexDiff {
treeWalk.addTree(new EmptyTreeIterator()); treeWalk.addTree(new EmptyTreeIterator());
treeWalk.addTree(new DirCacheIterator(dirCache)); treeWalk.addTree(new DirCacheIterator(dirCache));
treeWalk.addTree(initialWorkingTreeIterator); treeWalk.addTree(initialWorkingTreeIterator);
Collection<TreeFilter> filters = new ArrayList<TreeFilter>( Collection<TreeFilter> filters = new ArrayList<TreeFilter>(4);
filter == null ? 3 : 4);
if (filter != null) if (filter != null)
filters.add(filter); filters.add(filter);
filters.add(new NotIgnoredFilter(WORKDIR)); filters.add(new NotIgnoredFilter(WORKDIR));

Loading…
Cancel
Save