/** * Retrieve file status * * @param path * @return file status * @throws IOException */ private Status getFileStatus(String path) throws IOException { AdaptableFileTreeIterator fileTreeIterator = new AdaptableFileTreeIterator(repository, ResourcesPlugin.getWorkspace().getRoot()); IndexDiff indexDiff = new IndexDiff(repository, Constants.HEAD, fileTreeIterator); Set<String> repositoryPaths = Collections.singleton(path); indexDiff.setFilter(PathFilterGroup.createFromStrings(repositoryPaths)); indexDiff.diff(null, 0, 0, ""); // $NON-NLS-1$ return getFileStatus(path, indexDiff); }
private IndexDiffData calcIndexDiffDataIncremental( IProgressMonitor monitor, String jobName, Collection<String> filesToUpdate, Collection<IResource> resourcesToUpdate) throws IOException { if (indexDiffData == null) // Incremental update not possible without prior indexDiffData // -> do full refresh instead return calcIndexDiffDataFull(monitor, jobName); EclipseGitProgressTransformer jgitMonitor = new EclipseGitProgressTransformer(monitor); List<String> treeFilterPaths = calcTreeFilterPaths(filesToUpdate); WorkingTreeIterator iterator = IteratorService.createInitialIterator(repository); if (iterator == null) return null; // workspace is closed IndexDiff diffForChangedResources = new IndexDiff(repository, Constants.HEAD, iterator); diffForChangedResources.setFilter(PathFilterGroup.createFromStrings(treeFilterPaths)); diffForChangedResources.diff(jgitMonitor, 0, 0, jobName); return new IndexDiffData( indexDiffData, filesToUpdate, resourcesToUpdate, diffForChangedResources); }