Skip to content
  • Duy Nguyen's avatar
    attr: more matching optimizations from .gitignore · 82dce998
    Duy Nguyen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    .gitattributes and .gitignore share the same pattern syntax but has
    separate matching implementation. Over the years, ignore's
    implementation accumulates more optimizations while attr's stays the
    same.
    
    This patch reuses the core matching functions that are also used by
    excluded_from_list. excluded_from_list and path_matches can't be
    merged due to differences in exclude and attr, for example:
    
    * "!pattern" syntax is forbidden in .gitattributes.  As an attribute
      can be unset (i.e. set to a special value "false") or made back to
      unspecified (i.e. not even set to "false"), "!pattern attr" is unclear
      which one it means.
    
    * we support attaching attributes to directories, but git-core
      internally does not currently make use of attributes on
      directories.
    
    Signed-off-by: default avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    82dce998