1. 10 Mar, 2018 3 commits
    • ignore: honor case insensitivity for negative ignores · 4296a36b
      When computing negative ignores, we throw away any rule which does not
      undo a previous rule to optimize. But on case insensitive file systems,
      we need to keep in mind that a negative ignore can also undo a previous
      rule with different case, which we did not yet honor while determining
      whether a rule undoes a previous one. So in the following example, we
      fail to unignore the "/Case" directory:
      
          /case
          !/Case
      
      Make both paths checking whether a plain- or wildcard-based rule undo a
      previous rule aware of case-insensitivity. This fixes the described
      issue.
      Patrick Steinhardt committed
    • ignore: keep negative rules containing wildcards · 5c15cd94
      Ignore rules allow for reverting a previously ignored rule by prefixing
      it with an exclamation mark. As such, a negative rule can only override
      previously ignored files. While computing all ignore patterns, we try to
      use this fact to optimize away some negative rules which do not override
      any previous patterns, as they won't change the outcome anyway.
      
      In some cases, though, this optimization causes us to get the actual
      ignores wrong for some files. This may happen whenever the pattern
      contains a wildcard, as we are unable to reason about whether a pattern
      overrides a previous pattern in a sane way. This happens for example in
      the case where a gitignore file contains "*.c" and "!src/*.c", where we
      wouldn't un-ignore files inside of the "src/" subdirectory.
      
      In this case, the first solution coming to mind may be to just strip the
      "src/" prefix and simply compare the basenames. While that would work
      here, it would stop working as soon as the basename pattern itself is
      different, like for example with "*x.c" and "!src/*.c. As such, we
      settle for the easier fix of just not optimizing away rules that contain
      a wildcard.
      Patrick Steinhardt committed
  2. 17 May, 2017 1 commit
  3. 17 Feb, 2017 2 commits
  4. 19 Apr, 2016 1 commit
    • ignore: fix directory limits when searching for star-star · 1c3018eb
      In order to match the star-star, we disable the flag that's looking for
      a single path element, but that leads to searching for the pattern in
      the middle of elements in the input string.
      
      Mark when we're handing a star-star so we jump over the elements in our
      attempt to match the part of the pattern that comes after the star-star.
      
      While here, tighten up the check so we don't allow invalid rules
      through.
      Carlos Martín Nieto committed
  5. 18 Apr, 2016 1 commit
  6. 02 Apr, 2016 1 commit
  7. 13 May, 2015 1 commit
  8. 12 May, 2015 3 commits
  9. 28 Apr, 2015 1 commit
  10. 23 Apr, 2015 1 commit
  11. 17 Sep, 2014 1 commit
  12. 16 Sep, 2014 1 commit
    • Fix attribute lookup in index for bare repos · 1fbeb2f0
      When using a bare repo with an index, libgit2 attempts to read
      files from the index.  It caches those files based on the path
      to the file, specifically the path to the directory that contains
      the file.
      
      If there is no working directory, we use `git_path_dirname_r` to
      get the path to the containing directory.  However, for the
      `.gitattributes` file in the root of the repository, this ends up
      normalizing the containing path to `"."` instead of the empty
      string and the lookup the `.gitattributes` data fails.
      
      This adds a test of attribute lookups on bare repos and also
      fixes the problem by simply rewriting `"."` to be `""`.
      Russell Belfer committed
  13. 02 May, 2014 2 commits
  14. 01 May, 2014 1 commit
  15. 18 Apr, 2014 2 commits
  16. 17 Apr, 2014 2 commits
  17. 14 Apr, 2014 1 commit
    • Fix core.excludesfile named .gitignore · a9528b8f
      Ignore rules with slashes in them are matched using FNM_PATHNAME
      and use the path to the .gitignore file from the root of the
      repository along with the path fragment (including slashes) in
      the ignore file itself.  Unfortunately, the relative path to the
      .gitignore file was being applied to the global core.excludesfile
      if that was also named ".gitignore".
      
      This fixes that with more precise matching and includes test for
      ignore rules with leading slashes (which were the primary example
      of this being broken in the real world).
      
      This also backports an improvement to the file context logic from
      the threadsafe-iterators branch where we don't rely on mutating
      the key of the attribute file name to generate the context path.
      Russell Belfer committed
  18. 06 Apr, 2014 1 commit
  19. 05 Apr, 2014 1 commit
  20. 25 Jan, 2014 1 commit
  21. 11 Dec, 2013 1 commit
    • Remove converting user error to GIT_EUSER · 25e0b157
      This changes the behavior of callbacks so that the callback error
      code is not converted into GIT_EUSER and instead we propagate the
      return value through to the caller.  Instead of using the
      giterr_capture and giterr_restore functions, we now rely on all
      functions to pass back the return value from a callback.
      
      To avoid having a return value with no error message, the user
      can call the public giterr_set_str or some such function to set
      an error message.  There is a new helper 'giterr_set_callback'
      that functions can invoke after making a callback which ensures
      that some error message was set in case the callback did not set
      one.
      
      In places where the sign of the callback return value is
      meaningful (e.g. positive to skip, negative to abort), only the
      negative values are returned back to the caller, obviously, since
      the other values allow for continuing the loop.
      
      The hardest parts of this were in the checkout code where positive
      return values were overloaded as meaningful values for checkout.
      I fixed this by adding an output parameter to many of the internal
      checkout functions and removing the overload.  This added some
      code, but it is probably a better implementation.
      
      There is some funkiness in the network code where user provided
      callbacks could be returning a positive or a negative value and
      we want to rely on that to cancel the loop.  There are still a
      couple places where an user error might get turned into GIT_EUSER
      there, I think, though none exercised by the tests.
      Russell Belfer committed
  22. 14 Nov, 2013 1 commit