Class AttributesHandler


  • public class AttributesHandler
    extends Object
    The attributes handler knows how to retrieve, parse and merge attributes from the various gitattributes files. Furthermore it collects and expands macro expressions. The method getAttributes() yields the ready processed attributes for the current path represented by the TreeWalk

    The implementation is based on the specifications in http://git-scm.com/docs/gitattributes

    Since:
    4.3
    • Method Detail

      • mergeAttributes

        protected void mergeAttributes​(@Nullable
                                       AttributesNode node,
                                       String entryPath,
                                       boolean isDirectory,
                                       Attributes result)
        Merges the matching node attributes for an entry path.
        Parameters:
        node - the node to scan for matches to entryPath
        entryPath - the path to test. The path must be relative to this attribute node's own repository path, and in repository path format (uses '/' and not '\').
        isDirectory - true if the target item is a directory.
        result - that will hold the attributes matching this entry path. This method will NOT override any existing entry in attributes.
      • expandMacro

        protected void expandMacro​(Attribute attr,
                                   Attributes result)
        Expand a macro
        Parameters:
        attr - a Attribute
        result - contains the (recursive) expanded and merged macro attributes including the attribute iself