1. 12 Dec, 2019 1 commit
  2. 12 Jul, 2019 4 commits
    • attr_file: ignore macros defined in subdirectories · f8346905
      Right now, we are unconditionally applying all macros found in a
      gitatttributes file. But quoting gitattributes(5):
      
          Custom macro attributes can be defined only in top-level
          gitattributes files ($GIT_DIR/info/attributes, the .gitattributes
          file at the top level of the working tree, or the global or
          system-wide gitattributes files), not in .gitattributes files in
          working tree subdirectories. The built-in macro attribute "binary"
          is equivalent to:
      
      So gitattribute files in subdirectories of the working tree may
      explicitly _not_ contain macro definitions, but we do not currently
      enforce this limitation.
      
      This patch introduces a new parameter to the gitattributes parser that
      tells whether macros are allowed in the current file or not. If set to
      `false`, we will still parse macros, but silently ignore them instead of
      adding them to the list of defined macros. Update all callers to
      correctly determine whether the to-be-parsed file may contain macros or
      not. Most importantly, when walking up the directory hierarchy, we will
      only set it to `true` once it reaches the root directory of the repo
      itself.
      
      Add a test that verifies that we are indeed not applying macros from
      subdirectories. Previous to these changes, the test would've failed.
      Patrick Steinhardt committed
    • tests: attr: verify that in-memory macros are respected · df417a43
      Add some tests to ensure that the `git_attr_add_macro` function works as
      expected.
      Patrick Steinhardt committed
    • tests: attr: implement tests to verify attribute rewriting behaviour · 4a7f704f
      Implement some tests that verify that we are correctly updating
      gitattributes when rewriting or unlinking the corresponding files.
      Patrick Steinhardt committed
    • tests: attr: extract macro tests into their own suite · ed854aa0
      As macros are a specific functionality in the gitattributes code, it
      makes sense to extract them into their own test suite, too. This makes
      finding macro-related tests easier.
      Patrick Steinhardt committed