1. 15 Jun, 2019 3 commits
    • tag: add underscore to `from` function · e45350fe
      The majority of functions are named `from_something` (with an
      underscore) instead of `fromsomething`.  Update the tag function for
      consistency with the rest of the library.
      Edward Thomson 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
  2. 22 Jan, 2019 1 commit
  3. 17 Jan, 2019 1 commit
  4. 01 Dec, 2018 1 commit
  5. 25 Oct, 2018 1 commit
    • tag: fix out of bounds read when searching for tag message · ee11d47e
      When parsing tags, we skip all unknown fields that appear before the tag
      message. This skipping is done by using a plain `strstr(buffer, "\n\n")`
      to search for the two newlines that separate tag fields from tag
      message. As it is not possible to supply a buffer length to `strstr`,
      this call may skip over the buffer's end and thus result in an out of
      bounds read. As `strstr` may return a pointer that is out of bounds, the
      following computation of `buffer_end - buffer` will overflow and result
      in an allocation of an invalid length.
      
      Fix the issue by using `git__memmem` instead. Add a test that verifies
      parsing the tag fails not due to the allocation failure but due to the
      tag having no message.
      Patrick Steinhardt committed
  6. 22 Jun, 2018 1 commit
    • tag: implement function to parse raw data · af5cd936
      Currently, parsing objects is strictly tied to having an ODB object
      available. This makes it hard to parse an object when all that is
      available is its raw object and size. Furthermore, hacking around that
      limitation by directly creating an ODB structure either on stack or on
      heap does not really work that well due to ODB objects being reference
      counted and then automatically free'd when reaching a reference count of
      zero.
      
      Implement a function `git_tag__parse_raw` to parse a tag object from a
      pair of `data` and `size`.
      Patrick Steinhardt committed
  7. 10 Jun, 2018 1 commit
  8. 03 Jul, 2017 1 commit
    • Make sure to always include "common.h" first · 0c7f49dd
      Next to including several files, our "common.h" header also declares
      various macros which are then used throughout the project. As such, we
      have to make sure to always include this file first in all
      implementation files. Otherwise, we might encounter problems or even
      silent behavioural differences due to macros or defines not being
      defined as they should be. So in fact, our header and implementation
      files should make sure to always include "common.h" first.
      
      This commit does so by establishing a common include pattern. Header
      files inside of "src" will now always include "common.h" as its first
      other file, separated by a newline from all the other includes to make
      it stand out as special. There are two cases for the implementation
      files. If they do have a matching header file, they will always include
      this one first, leading to "common.h" being transitively included as
      first file. If they do not have a matching header file, they instead
      include "common.h" as first file themselves.
      
      This fixes the outlined problems and will become our standard practice
      for header and source files inside of the "src/" from now on.
      Patrick Steinhardt committed
  9. 29 Dec, 2016 1 commit
  10. 25 Apr, 2016 1 commit
  11. 21 Dec, 2015 1 commit
  12. 03 Mar, 2015 1 commit
    • Remove the signature from ref-modifying functions · 659cf202
      The signature for the reflog is not something which changes
      dynamically. Almost all uses will be NULL, since we want for the
      repository's default identity to be used, making it noise.
      
      In order to allow for changing the identity, we instead provide
      git_repository_set_ident() and git_repository_ident() which allow a user
      to override the choice of signature.
      Carlos Martín Nieto committed
  13. 13 Feb, 2015 2 commits
  14. 05 Dec, 2014 1 commit
  15. 24 Oct, 2014 1 commit
  16. 13 May, 2014 1 commit
  17. 15 Jan, 2014 1 commit
  18. 11 Dec, 2013 3 commits
    • 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
    • Further EUSER and error propagation fixes · dab89f9b
      This continues auditing all the places where GIT_EUSER is being
      returned and making sure to clear any existing error using the
      new giterr_user_cancel helper.  As a result, places that relied
      on intercepting GIT_EUSER but having the old error preserved also
      needed to be cleaned up to correctly stash and then retrieve the
      actual error.
      
      Additionally, as I encountered places where error codes were not
      being propagated correctly, I tried to fix them up.  A number of
      those fixes are included in the this commit as well.
      Russell Belfer committed
  19. 15 Aug, 2013 1 commit
  20. 29 May, 2013 1 commit
  21. 21 May, 2013 1 commit
  22. 11 May, 2013 1 commit
    • refs: remove the OID/SYMBOLIC filtering · 2b562c3a
      Nobody should ever be using anything other than ALL at this level, so
      remove the option altogether.
      
      As part of this, git_reference_foreach_glob is now implemented in the
      frontend using an iterator. Backends will later regain the ability of
      doing the glob filtering in the backend.
      Carlos Martín Nieto committed
  23. 30 Apr, 2013 2 commits
  24. 29 Apr, 2013 1 commit
  25. 22 Apr, 2013 4 commits
  26. 21 Apr, 2013 1 commit
    • Move odb_backend implementors stuff into git2/sys · 83cc70d9
      This moves some of the odb_backend stuff that is related to the
      internals of an odb_backend implementation into include/git2/sys.
      
      Some of the stuff related to streaming I left in include/git2
      because it seemed like it would be reasonably needed by a normal
      user who wanted to stream objects into and out of the ODB.
      
      Also, I added APIs for traversing the list of backends so that
      some of the tests would not need to access ODB internals.
      Russell Belfer committed
  27. 31 Mar, 2013 1 commit
  28. 07 Mar, 2013 1 commit
  29. 08 Jan, 2013 1 commit
  30. 03 Dec, 2012 1 commit
  31. 01 Dec, 2012 1 commit