1. 27 Aug, 2019 1 commit
  2. 20 Jul, 2019 1 commit
  3. 18 Jul, 2019 1 commit
    • ignore: fix determining whether a shorter pattern negates another · 6f6340af
      When computing whether we need to store a negative pattern, we iterate
      through all previously known patterns and check whether the negative
      pattern undoes any of the previous ones. In doing so we call `wildmatch`
      and check it's return for any negative error values. If there was a
      negative return, we will abort and bubble up that error to the caller.
      
      In fact, this check for negative values stems from the time where we
      still used `fnmatch` instead of `wildmatch`. For `fnmatch`, negative
      values indicate a "real" error, while for `wildmatch` a negative value
      may be returned if the matching was prematurely aborted. A premature
      abort may for example also happen if the pattern matches a prefix of the
      haystack if the pattern is shorter. Returning an error in that case is
      the wrong thing to do.
      
      Fix the code to compare for equality with `WM_MATCH`, only. Negative
      values returned by `wildmatch` are perfectly fine and thus should be
      ignored. Add a test that verifies we do not see the error.
      Patrick Steinhardt committed
  4. 15 Jun, 2019 1 commit
    • attr_file: convert to use `wildmatch` · 05f9986a
      Upstream git has converted to use `wildmatch` instead of
      `fnmatch`. Convert our gitattributes logic to use `wildmatch` as
      the last user of `fnmatch`. Please, don't expect I know what I'm
      doing here: the fnmatch parser is one of the most fun things to
      play around with as it has a sh*tload of weird cases. In all
      honesty, I'm simply relying on our tests that are by now rather
      comprehensive in that area.
      
      The conversion actually fixes compatibility with how git.git
      parser "**" patterns when the given path does not contain any
      directory separators. Previously, a pattern "**.foo" erroneously
      wouldn't match a file "x.foo", while git.git would match.
      
      Remove the new-unused LEADINGDIR/NOLEADINGDIR flags for
      `git_attr_fnmatch`.
      Patrick Steinhardt committed
  5. 13 Jun, 2019 2 commits
    • attr_file: account for escaped escapes when searching trailing space · b3b6a39d
      When determining the trailing space length, we need to honor
      whether spaces are escaped or not. Currently, we do not check
      whether the escape itself is escaped, though, which might
      generate an off-by-one in that case as we will simply treat the
      space as escaped.
      
      Fix this by checking whether the backslashes preceding the space
      are themselves escaped.
      Patrick Steinhardt committed
    • attr_file: fix unescaping of escapes required for fnmatch · 10ac298c
      When parsing attribute patterns, we will eventually unescape the
      parsed pattern. This is required because we require custom
      escapes for whitespace characters, as normally they are used to
      terminate the current pattern. Thing is, we don't only unescape
      those whitespace characters, but in fact all escaped sequences.
      So for example if the pattern was "\*", we unescape that to "*".
      As this is directly passed to fnmatch(3) later, fnmatch would
      treat it as a simple glob matching all files where it should
      instead only match a file with name "*".
      
      Fix the issue by unescaping spaces, only. Add a bunch of tests to
      exercise escape parsing.
      Patrick Steinhardt committed
  6. 07 Jun, 2019 1 commit
    • tests: unify ignore tests into their own dir · 01dda5ff
      We had several occasions where tests for the gitignore had been
      added to status::ignore instead of the easier-to-handle
      attr::ignore test suite. This most likely resulted from the fact
      that the attr::ignore test suite is not easy to discover inside
      of the attr folder. Furthermore, ignore being part of the
      attributes code is an implementation detail, only, and thus
      shouldn't be stressed as much.
      
      Improve this by moving both attr::ignore and status::ignore tests
      into a new ignore test suite.
      Patrick Steinhardt committed