Source:
<code>public boolean diff() throws IOException { boolean changesExist = false; DirCache dirCache = repository.readDirCache(); TreeWalk treeWalk = new TreeWalk(repository); treeWalk.reset(); treeWalk.setRecursive(true); if (tree != null) treeWalk.addTree(tree); else treeWalk.addTree(new EmptyTreeIterator()); treeWalk.addTree(new DirCacheIterator(dirCache)); treeWalk.addTree(initialWorkingTreeIterator); treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setFilter(AndTreeFilter.create(new TreeFilter[] { TreeFilter.ANY_DIFF, new NotIgnoredFilter(WORKDIR), <START> new SkipWorkTreeFilter(1) })); <END> while (treeWalk.next()) { AbstractTreeIterator treeIterator = treeWalk.getTree(TREE, AbstractTreeIterator.class); DirCacheIterator dirCacheIterator = treeWalk.getTree(INDEX, DirCacheIterator.class); WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR, WorkingTreeIterator.class); FileMode fileModeTree = treeWalk.getFileMode(TREE); if (treeIterator != null) { if (dirCacheIterator != null) { if (!treeIterator.getEntryObjectId().equals( dirCacheIterator.getEntryObjectId())) { changed.add(dirCacheIterator.getEntryPathString()); changesExist = true; } } else { if (!fileModeTree.equals(FileMode.TYPE_TREE)) { removed.add(treeIterator.getEntryPathString()); changesExist = true; } } } else { if (dirCacheIterator != null) { added.add(dirCacheIterator.getEntryPathString()); changesExist = true; } else { if (workingTreeIterator != null && !workingTreeIterator.isEntryIgnored()) { untracked.add(workingTreeIterator.getEntryPathString()); changesExist = true; } } } if (dirCacheIterator != null) { if (workingTreeIterator == null) { missing.add(dirCacheIterator.getEntryPathString()); changesExist = true; } else { if (!dirCacheIterator.idEqual(workingTreeIterator)) { modified.add(dirCacheIterator.getEntryPathString()); changesExist = true; } } } } return changesExist; }</code><technical_language>s/1/INDEX/</technical_language>

Target:
public boolean diff() throws IOException { boolean changesExist = false; DirCache dirCache = repository.readDirCache(); TreeWalk treeWalk = new TreeWalk(repository); treeWalk.reset(); treeWalk.setRecursive(true); if (tree != null) treeWalk.addTree(tree); else treeWalk.addTree(new EmptyTreeIterator()); treeWalk.addTree(new DirCacheIterator(dirCache)); treeWalk.addTree(initialWorkingTreeIterator); treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setFilter(AndTreeFilter.create(new TreeFilter[] { new NotIgnoredFilter(WORKDIR), new SkipWorkTreeFilter(INDEX), TreeFilter.ANY_DIFF })); while (treeWalk.next()) { AbstractTreeIterator treeIterator = treeWalk.getTree(TREE, AbstractTreeIterator.class); DirCacheIterator dirCacheIterator = treeWalk.getTree(INDEX, DirCacheIterator.class); WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR, WorkingTreeIterator.class); FileMode fileModeTree = treeWalk.getFileMode(TREE); if (treeIterator != null) { if (dirCacheIterator != null) { if (!treeIterator.getEntryObjectId().equals( dirCacheIterator.getEntryObjectId())) { changed.add(dirCacheIterator.getEntryPathString()); changesExist = true; } } else { if (!fileModeTree.equals(FileMode.TYPE_TREE)) { removed.add(treeIterator.getEntryPathString()); changesExist = true; } } } else { if (dirCacheIterator != null) { added.add(dirCacheIterator.getEntryPathString()); changesExist = true; } else { if (workingTreeIterator != null && !workingTreeIterator.isEntryIgnored()) { untracked.add(workingTreeIterator.getEntryPathString()); changesExist = true; } } } if (dirCacheIterator != null) { if (workingTreeIterator == null) { missing.add(dirCacheIterator.getEntryPathString()); changesExist = true; } else { if (!dirCacheIterator.idEqual(workingTreeIterator)) { modified.add(dirCacheIterator.getEntryPathString()); changesExist = true; } } } } return changesExist; }