/** * Retrieve the {@link org.eclipse.jgit.attributes.AttributesNode} for the * current entry. * * @param reader * {@link org.eclipse.jgit.lib.ObjectReader} used to parse the * .gitattributes entry. * @return {@link org.eclipse.jgit.attributes.AttributesNode} for the * current entry. * @throws java.io.IOException * @since 4.2 */ public AttributesNode getEntryAttributesNode(ObjectReader reader) throws IOException { if (attributesNode == null) { attributesNode = findAttributes(reader); } return attributesNode.getRules().isEmpty() ? null : attributesNode; }
/** Parses a list of rules from the given file, returning an empty list if the file doesn't exist. */ private static List<AttributesRule> parseRules(@Nullable File file) { if (file != null && file.exists() && file.isFile()) { try (InputStream stream = new FileInputStream(file)) { AttributesNode parsed = new AttributesNode(); parsed.parse(stream); return parsed.getRules(); } catch (IOException e) { // no need to crash the whole plugin System.err.println("Problem parsing " + file.getAbsolutePath()); e.printStackTrace(); } } return Collections.emptyList(); }
AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = entry.openInputStream()) { r.parse(in); } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load(ObjectReader reader) throws IOException { AttributesNode r = new AttributesNode(); ObjectLoader loader = reader.open(objectId); if (loader != null) { try (InputStream in = loader.openStream()) { r.parse(in); } } return r.getRules().isEmpty() ? null : r; } }
if (node == null) return; List<AttributesRule> rules = node.getRules();
private static AttributesNode loadAttributes(ObjectReader reader, AnyObjectId id) throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = reader.open(id, OBJ_BLOB).openStream()) { r.parse(in); } return r.getRules().isEmpty() ? noAttributes() : r; }
/** * Load the attributes node * * @return the attributes node * @throws java.io.IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); File attributes = fs.resolve(repository.getDirectory(), Constants.INFO_ATTRIBUTES); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributes); return r.getRules().isEmpty() ? null : r; }
/** * Load the attributes node * * @return the attributes node * @throws java.io.IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) { //$NON-NLS-1$ attributesFile = fs.resolve(fs.userHome(), path.substring(2)); } else { attributesFile = fs.resolve(null, path); } FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; } }
continue; for (AttributesRule rule : node.getRules()) { if (rule.getPattern().startsWith(MACRO_PREFIX)) { expansions.put(rule.getPattern()
/** * Retrieve the {@link AttributesNode} for the current entry. * * @param reader * {@link ObjectReader} used to parse the .gitattributes entry. * @return {@link AttributesNode} for the current entry. * @throws IOException * @since 4.2 */ public AttributesNode getEntryAttributesNode(ObjectReader reader) throws IOException { if (attributesNode == null) { attributesNode = findAttributes(reader); } return attributesNode.getRules().isEmpty() ? null : attributesNode; }
/** * Retrieve the {@link org.eclipse.jgit.attributes.AttributesNode} for the * current entry. * * @param reader * {@link org.eclipse.jgit.lib.ObjectReader} used to parse the * .gitattributes entry. * @return {@link org.eclipse.jgit.attributes.AttributesNode} for the * current entry. * @throws java.io.IOException * @since 4.2 */ public AttributesNode getEntryAttributesNode(ObjectReader reader) throws IOException { if (attributesNode == null) { attributesNode = findAttributes(reader); } return attributesNode.getRules().isEmpty() ? null : attributesNode; }
/** Parses a list of rules from the given file, returning an empty list if the file doesn't exist. */ private static List<AttributesRule> parseRules(@Nullable File file) { if (file != null && file.exists() && file.isFile()) { try (InputStream stream = new FileInputStream(file)) { AttributesNode parsed = new AttributesNode(); parsed.parse(stream); return parsed.getRules(); } catch (IOException e) { // no need to crash the whole plugin System.err.println("Problem parsing " + file.getAbsolutePath()); e.printStackTrace(); } } return Collections.emptyList(); }
AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); InputStream in = entry.openInputStream(); try { r.parse(in); } finally { in.close(); } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = entry.openInputStream()) { r.parse(in); } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load(ObjectReader reader) throws IOException { AttributesNode r = new AttributesNode(); ObjectLoader loader = reader.open(objectId); if (loader != null) { InputStream in = loader.openStream(); try { r.parse(in); } finally { in.close(); } } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load(ObjectReader reader) throws IOException { AttributesNode r = new AttributesNode(); ObjectLoader loader = reader.open(objectId); if (loader != null) { try (InputStream in = loader.openStream()) { r.parse(in); } } return r.getRules().isEmpty() ? null : r; } }
private static AttributesNode loadAttributes(ObjectReader reader, AnyObjectId id) throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = reader.open(id, OBJ_BLOB).openStream()) { r.parse(in); } return r.getRules().isEmpty() ? noAttributes() : r; }
/** * @return the attributes node * @throws IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); File attributes = fs.resolve(repository.getDirectory(), Constants.INFO_ATTRIBUTES); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributes); return r.getRules().isEmpty() ? null : r; }
private static AttributesNode loadAttributes(ObjectReader reader, AnyObjectId id) throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = reader.open(id, OBJ_BLOB).openStream()) { r.parse(in); } return r.getRules().isEmpty() ? noAttributes() : r; }
/** * Load the attributes node * * @return the attributes node * @throws java.io.IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); File attributes = fs.resolve(repository.getDirectory(), Constants.INFO_ATTRIBUTES); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributes); return r.getRules().isEmpty() ? null : r; }