/** * Put an attribute * * @param a * an {@link org.eclipse.jgit.attributes.Attribute} */ public void put(Attribute a) { map.put(a.getKey(), a); }
/** Parses an attribute value from a list of rules, returning null if there is no match for the given key. */ private static @Nullable String findAttributeInRules(String subpath, boolean isFolder, String key, List<AttributesRule> rules) { String value = null; // later rules override earlier ones for (AttributesRule rule : rules) { if (rule.isMatch(subpath, isFolder)) { for (Attribute attribute : rule.getAttributes()) { if (attribute.getKey().equals(key)) { value = attribute.getValue(); } } } } return value; } }
if (result.containsKey(attr.getKey())) return; List<Attribute> expansion = expansions.get(attr.getKey()); if (expansion == null) { return; switch (e.getState()) { case SET: expandMacro(new Attribute(e.getKey(), State.UNSET), result); break; case UNSET: expandMacro(new Attribute(e.getKey(), State.SET), result); break; case UNSPECIFIED: expandMacro(new Attribute(e.getKey(), State.UNSPECIFIED), result); break; case CUSTOM: default: expandMacro(new Attribute(e.getKey(), attr.getValue()), result); expandMacro(new Attribute(e.getKey(), State.UNSPECIFIED), result);
attributes.remove(a.getKey());
/** * Put an attribute * * @param a * an {@link org.eclipse.jgit.attributes.Attribute} */ public void put(Attribute a) { map.put(a.getKey(), a); }
/** * @param a */ public void put(Attribute a) { map.put(a.getKey(), a); }
/** Parses an attribute value from a list of rules, returning null if there is no match for the given key. */ private static @Nullable String findAttributeInRules(String subpath, boolean isFolder, String key, List<AttributesRule> rules) { String value = null; // later rules override earlier ones for (AttributesRule rule : rules) { if (rule.isMatch(subpath, isFolder)) { for (Attribute attribute : rule.getAttributes()) { if (attribute.getKey().equals(key)) { value = attribute.getValue(); } } } } return value; } }
if (result.containsKey(attr.getKey())) return; List<Attribute> expansion = expansions.get(attr.getKey()); if (expansion == null) { return; switch (e.getState()) { case SET: expandMacro(new Attribute(e.getKey(), State.UNSET), result); break; case UNSET: expandMacro(new Attribute(e.getKey(), State.SET), result); break; case UNSPECIFIED: expandMacro(new Attribute(e.getKey(), State.UNSPECIFIED), result); break; case CUSTOM: default: expandMacro(new Attribute(e.getKey(), attr.getValue()), result); expandMacro(new Attribute(e.getKey(), State.UNSPECIFIED), result);
if (result.containsKey(attr.getKey())) return; List<Attribute> expansion = expansions.get(attr.getKey()); if (expansion == null) { return; switch (e.getState()) { case SET: expandMacro(new Attribute(e.getKey(), State.UNSET), result); break; case UNSET: expandMacro(new Attribute(e.getKey(), State.SET), result); break; case UNSPECIFIED: expandMacro(new Attribute(e.getKey(), State.UNSPECIFIED), result); break; case CUSTOM: default: expandMacro(new Attribute(e.getKey(), attr.getValue()), result); expandMacro(new Attribute(e.getKey(), State.UNSPECIFIED), result);
attributes.remove(a.getKey());
/** * see {@link TreeWalk#getAttributes()} * * @return the {@link Attributes} for the current path represented by the * {@link TreeWalk} * @throws IOException */ public Attributes getAttributes() throws IOException { String entryPath = treeWalk.getPathString(); boolean isDirectory = (treeWalk.getFileMode() == FileMode.TREE); Attributes attributes = new Attributes(); // Gets the info attributes mergeInfoAttributes(entryPath, isDirectory, attributes); // Gets the attributes located on the current entry path mergePerDirectoryEntryAttributes(entryPath, isDirectory, treeWalk.getTree(WorkingTreeIterator.class), treeWalk.getTree(DirCacheIterator.class), treeWalk.getTree(CanonicalTreeParser.class), attributes); // Gets the attributes located in the global attribute file mergeGlobalAttributes(entryPath, isDirectory, attributes); // now after all attributes are collected - in the correct hierarchy // order - remove all unspecified entries (the ! marker) for (Attribute a : attributes.getAll()) { if (a.getState() == State.UNSPECIFIED) attributes.remove(a.getKey()); } return attributes; }