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>
This commit is contained in:
Shawn O. Pearce 2010-12-07 18:27:59 -08:00
parent 11fd0fe03a
commit f4e9c8890c
1 changed files with 1 additions and 2 deletions

View File

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