1. 15 Jun, 2019 8 commits
    • fnmatch: remove unused code · 13ded47c
      The `fnmatch` code has now been completely replaced by
      `wildmatch`, same as upstream git.git has been doing in 2014.
      Remove it.
      Patrick Steinhardt committed
    • 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
    • config_file: use `wildmatch` to evaluate conditionals · 5811e3ba
      We currently use `p_fnmatch` to compute whether a given "gitdir:"
      or "gitdir/i:" conditional matches the current configuration file
      path. As git.git has moved to use `wildmatch` instead of
      `p_fnmatch` throughout its complete codebase, we evaluate
      conditionals inconsistently with git.git in some special cases.
      
      Convert `p_fnmatch` to use `wildmatch`. The `FNM_LEADINGDIR` flag
      cannot be translated to `wildmatch`, but in fact git.git doesn't
      use it here either. And in fact, dropping it while we go
      increases compatibility with git.git.
      Patrick Steinhardt committed
    • config_file: do not include trailing '/' for "gitdir" conditionals · cf1a114b
      When evaluating "gitdir:" and "gitdir/i:" conditionals, we
      currently compare the given pattern with the value of
      `git_repository_path`. Thing is though that `git_repository_path`
      returns the gitdir path with trailing '/', while we actually need
      to match against the gitdir without it.
      
      Fix this issue by stripping the trailing '/' previous to
      matching. Add various tests to ensure we get this right.
      Patrick Steinhardt committed
    • config_file: refactor `do_match_gitdir` to improve readability · 5d987f7d
      The function `do_match_gitdir` has some horribly named parameters
      and variables. Rename them to improve readability. Furthermore,
      fix a potentially undetected out-of-memory condition when
      appending "**" to the pattern.
      Patrick Steinhardt committed
    • global: convert trivial `fnmatch` users to use `wildcard` · de70bb46
      Upstream git.git has converted its codebase to use wildcard in
      favor of fnmatch in commit 70a8fc999d (stop using fnmatch (either
      native or compat), 2014-02-15). To keep our own regex-matching in
      line with what git does, convert all trivial instances of
      `fnmatch` usage to use `wildcard`, instead. Trivial usage is
      defined to be use of `fnmatch` with either no flags or flags that
      have a 1:1 equivalent in wildmatch (PATHNAME, IGNORECASE).
      Patrick Steinhardt committed
    • posix: remove implicit include of "fnmatch.h" · 451df793
      We're about to phase out our bundled fnmatch implementation as
      git.git has moved to wildmatch long ago in 2014. To make it
      easier to spot which files are stilll using fnmatch, remove the
      implicit "fnmatch.h" include in "posix.h" and instead include it
      explicitly.
      Patrick Steinhardt committed
    • wildmatch: import wildmatch from git.git · a9f57629
      In commit 70a8fc999d (stop using fnmatch (either native or
      compat), 2014-02-15), upstream git has switched over all code
      from their internal fnmatch copy to its new wildmatch code. We
      haven't followed suit, and thus have developed some
      incompatibilities in how we match regular expressions.
      
      Import git's wildmatch from v2.22.0 and add a test suite based on
      their t3070-wildmatch.sh tests.
      Patrick Steinhardt committed
  2. 14 Jun, 2019 8 commits
  3. 13 Jun, 2019 11 commits
  4. 11 Jun, 2019 7 commits
  5. 10 Jun, 2019 6 commits