AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = entry.openInputStream()) { r.parse(in); } return r.getRules().isEmpty() ? null : r; } }
BufferedReader br = asReader(in); String txt; while ((txt = br.readLine()) != null) {
/** * 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; }
/** * 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; }
static void loadRulesFromFile(AttributesNode r, File attrs) throws FileNotFoundException, IOException { if (attrs.exists()) { try (FileInputStream in = new FileInputStream(attrs)) { r.parse(in); } } }
private static AttributesNode noAttributes() { return new AttributesNode(Collections.<AttributesRule> emptyList()); } }
/** * 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; } }
if (node == null) return; List<AttributesRule> rules = node.getRules();
static void loadRulesFromFile(AttributesNode r, File attrs) throws FileNotFoundException, IOException { if (attrs.exists()) { try (FileInputStream in = new FileInputStream(attrs)) { r.parse(in); } } }
private static AttributesNode noAttributes() { return new AttributesNode(Collections.<AttributesRule> emptyList()); } }
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; } }
/** * @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; }
continue; for (AttributesRule rule : node.getRules()) { if (rule.getPattern().startsWith(MACRO_PREFIX)) { expansions.put(rule.getPattern()
static void loadRulesFromFile(AttributesNode r, File attrs) throws FileNotFoundException, IOException { if (attrs.exists()) { FileInputStream in = new FileInputStream(attrs); try { r.parse(in); } finally { in.close(); } } }
private static AttributesNode noAttributes() { return new AttributesNode(Collections.<AttributesRule> emptyList()); } }
BufferedReader br = asReader(in); String txt; while ((txt = br.readLine()) != null) {
/** 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(); }
/** * 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; }
/** * 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; }
BufferedReader br = asReader(in); String txt; while ((txt = br.readLine()) != null) {