List of usage examples for org.eclipse.jgit.ignore IgnoreNode IgnoreNode
public IgnoreNode()
From source file:com.github.shyiko.ijignore.IjignoreFileContentIndexingVoter.java
License:Apache License
private IgnoreNode parseIgnoreFile(VirtualFile file) throws IOException { InputStream inputStream = file.getInputStream(); try {/*from ww w .jav a 2 s .com*/ IgnoreNode ignoreNode = new IgnoreNode(); ignoreNode.parse(inputStream); if (!ignoreNode.getRules().isEmpty()) { return ignoreNode; } } finally { inputStream.close(); } return null; }
From source file:org.eclipse.orion.server.cf.utils.Packager.java
License:Open Source License
protected void writeZip(IFileStore source, IPath path, ZipOutputStream zos) throws CoreException, IOException { /* load .cfignore if present */ IFileStore cfIgnoreFile = source.getChild(CF_IGNORE_FILE); if (cfIgnoreFile.fetchInfo().exists()) { IgnoreNode node = new IgnoreNode(); InputStream is = null;// ww w.java2 s. c om try { is = cfIgnoreFile.openInputStream(EFS.NONE, null); node.parse(is); cfIgnore.put(source.toURI(), node); } finally { if (is != null) is.close(); } } IFileInfo info = source.fetchInfo(EFS.NONE, null); if (info.isDirectory()) { if (!isIgnored(source, path, true)) for (IFileStore child : source.childStores(EFS.NONE, null)) writeZip(child, path.append(child.getName()), zos); } else { if (!isIgnored(source, path, false)) { ZipEntry entry = new ZipEntry(path.toString()); zos.putNextEntry(entry); IOUtilities.pipe(source.openInputStream(EFS.NONE, null), zos, true, false); } } }
From source file:org.eclipse.ptp.internal.rdt.sync.git.core.GitSyncFileFilter.java
License:Open Source License
/** * Load filtering rules from the file system * @throws IOException// w w w .jav a 2 s . c om * on problems reading from the file system */ public void loadFilter() throws IOException { Repository repo = jgitRepo.getRepository(); File exclude = repo.getFS().resolve(repo.getDirectory(), Constants.INFO_EXCLUDE); if (exclude.exists()) { FileInputStream in = new FileInputStream(exclude); try { IgnoreNode node = new IgnoreNode(); node.parse(in); for (org.eclipse.jgit.ignore.IgnoreRule rule : node.getRules()) { rules.add(new GitIgnoreRule(rule)); } } finally { in.close(); } } else { initialize(SyncManager.getDefaultFileFilter()); } }