1. 10 Apr, 2023 1 commit
  2. 12 Feb, 2023 1 commit
  3. 14 Jul, 2022 1 commit
  4. 20 Jun, 2022 3 commits
  5. 15 Jun, 2022 4 commits
  6. 27 Feb, 2022 1 commit
  7. 23 Feb, 2022 1 commit
  8. 01 Dec, 2021 2 commits
    • object: introduce a raw content validation function · 9f03ebd1
      Users may want to validate raw object content; provide them a function
      to do so.
      Edward Thomson committed
    • object: return GIT_EINVALID on parse errors · fc1a3f45
      Return `GIT_EINVALID` on parse errors so that direct callers of parse
      functions can determine when there was a failure to parse the object.
      
      The object parser functions will swallow this error code to prevent it
      from propagating down the chain to end-users.  (`git_merge` should not
      return `GIT_EINVALID` when a commit it tries to look up is not valid,
      this would be too vague to be useful.)
      
      The only public function that this affects is
      `git_signature_from_buffer`, which is now documented as returning
      `GIT_EINVALID` when appropriate.
      Edward Thomson committed
  9. 17 Oct, 2021 1 commit
    • str: introduce `git_str` for internal, `git_buf` is external · f0e693b1
      libgit2 has two distinct requirements that were previously solved by
      `git_buf`.  We require:
      
      1. A general purpose string class that provides a number of utility APIs
         for manipulating data (eg, concatenating, truncating, etc).
      2. A structure that we can use to return strings to callers that they
         can take ownership of.
      
      By using a single class (`git_buf`) for both of these purposes, we have
      confused the API to the point that refactorings are difficult and
      reasoning about correctness is also difficult.
      
      Move the utility class `git_buf` to be called `git_str`: this represents
      its general purpose, as an internal string buffer class.  The name also
      is an homage to Junio Hamano ("gitstr").
      
      The public API remains `git_buf`, and has a much smaller footprint.  It
      is generally only used as an "out" param with strict requirements that
      follow the documentation.  (Exceptions exist for some legacy APIs to
      avoid breaking callers unnecessarily.)
      
      Utility functions exist to convert a user-specified `git_buf` to a
      `git_str` so that we can call internal functions, then converting it
      back again.
      Edward Thomson committed
  10. 27 Nov, 2020 1 commit
  11. 25 Nov, 2020 1 commit
  12. 30 Jun, 2020 1 commit
  13. 15 Jan, 2020 1 commit
  14. 29 Jul, 2019 1 commit
  15. 18 Jul, 2019 1 commit
  16. 15 Jun, 2019 1 commit
  17. 22 Jan, 2019 1 commit
  18. 17 Jan, 2019 1 commit
  19. 01 Dec, 2018 1 commit
  20. 11 Oct, 2018 1 commit
  21. 22 Jun, 2018 1 commit
    • object: implement function to parse raw data · ca4db5f4
      Now that we have implement functions to parse all git objects from raw
      data, we can implement a generic function `git_object__from_raw` to
      create a structure of type `git_object`. This allows us to parse and
      interpret objects from raw data without having to touch the ODB at all,
      which is especially useful for object verification prior to accepting
      them into the repository.
      Patrick Steinhardt committed
  22. 20 Dec, 2017 1 commit
  23. 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
  24. 08 Jun, 2017 1 commit
    • settings: rename `GIT_OPT_ENABLE_SYNCHRONOUS_OBJECT_CREATION` · 6c23704d
      Initially, the setting has been solely used to enable the use of
      `fsync()` when creating objects. Since then, the use has been extended
      to also cover references and index files. As the option is not yet part
      of any release, we can still correct this by renaming the option to
      something more sensible, indicating not only correlation to objects.
      
      This commit renames the option to `GIT_OPT_ENABLE_FSYNC_GITDIR`. We also
      move the variable from the object to repository source code.
      Patrick Steinhardt committed
  25. 28 Feb, 2017 2 commits
  26. 29 Dec, 2016 1 commit
  27. 11 Mar, 2016 1 commit
    • object: avoid call of memset with ouf of bounds pointer · 61d7328d
      When computing a short OID we do this by first copying the
      leading parts into the new OID structure and then setting the
      trailing part to zero. In the case of the desired length being
      `GIT_OID_HEXSZ - 1` we will call `memset` with an out of bounds
      pointer and a length of 0. While this seems to cause no problems
      for common platforms the C89 standard does not explicitly state
      that calling `memset` with an out of bounds pointer and
      length of 0 is valid.
      
      Fix the potential issue by using the newly introduced
      `git_oid__cpy_prefix` function.
      Patrick Steinhardt committed
  28. 28 Feb, 2016 3 commits
  29. 30 Nov, 2015 1 commit
  30. 26 Jun, 2015 1 commit
    • Revert "object: correct the expected ID size in prefix lookup" · 3d9ef2dc
      This reverts commit 969d4b70.
      
      This was a fluke from Coverity. The length to all the APIs in the
      library is supposed to be passed in as nibbles, not bytes. Passing it as
      bytes would prevent us from parsing uneven-sized SHA1 strings.
      
      Also, the rest of the library was still using nibbles (including
      revparse and the odb_prefix APIs), so this change was seriously breaking
      things in unexpected ways. ^^
      Vicent Marti committed
  31. 10 Jun, 2015 1 commit
    • object: correct the expected ID size in prefix lookup · 969d4b70
      We take in a possibly partial ID by taking a length and working off of
      that to figure out whether to just look up the object or ask the
      backends for a prefix lookup.
      
      Unfortunately we've been checking the size against `GIT_OID_HEXSZ` which
      is the size of a *string* containing a full ID, whereas we need to check
      against the size we can have when it's a 20-byte array.
      
      Change the checks and comment to use `GIT_OID_RAWSZ` which is the
      correct size of a git_oid to have when full.
      Carlos Martín Nieto committed