1. 23 Feb, 2022 1 commit
  2. 08 Feb, 2022 1 commit
  3. 07 Feb, 2022 1 commit
    • push: Prepare pack before sending pack header. · 19ec5923
      For large pushes, preparing the pack can take a while. Currently we
      send the pack header first, followed by preparing the pack and then
      finally sending the pack. Unfortunately github.com will terminate
      a git-receive-pack command over http if it is idle for more than 10
      seconds. This is easily exceeded for a large push, and so the push is
      rejected with a Broken Pipe error.
      
      This patch moves the pack preparation ahead of sending the pack header,
      so that the timeout is avoided.
      
      prepare_pack() can be called multiple times but will only do the work
      once, so the original PREPARE_PACK call inside git_packbuilder_foreach()
      remains.
      Colin Stolley committed
  4. 28 Jan, 2022 1 commit
  5. 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
  6. 02 Oct, 2021 1 commit
  7. 01 Oct, 2021 1 commit
  8. 19 Jul, 2021 1 commit
  9. 15 Jul, 2021 1 commit
  10. 06 Dec, 2020 2 commits
  11. 05 Dec, 2020 1 commit
  12. 27 Nov, 2020 2 commits
  13. 25 Nov, 2020 1 commit
  14. 09 Jun, 2020 1 commit
  15. 01 Jun, 2020 1 commit
  16. 23 May, 2020 2 commits
  17. 07 Feb, 2020 1 commit
  18. 18 Jul, 2019 1 commit
  19. 17 Jul, 2019 1 commit
    • pack-objects: allocate memory more efficiently · c4df926b
      The packbuilder code allocates memory in chunks. When it needs to
      allocate, it tries to add 1024 to the number of objects and multiply by
      3/2. However, it actually multiplies by 1 instead, since it performs an
      integral division in the expression "3 / 2" and only then multiplies by
      the increased number of objects.
      
      The current behavior causes the code to waste massive amounts of time
      copying memory when it reallocates, causing inserting all non-blob
      objects in the Linux repository into a new pack to take some
      indeterminate time greater than 5 minutes instead of 52 seconds.
      
      Correct this error by first dividing by two, and only then multiplying
      by 3. We still check for overflow for the multiplication, which is the
      only part that can overflow. This appears to be the only place in the
      code base which has this problem.
      brian m. carlson committed
  20. 22 Feb, 2019 1 commit
  21. 15 Feb, 2019 3 commits
    • oidmap: introduce high-level setter for key/value pairs · 2e0a3048
      Currently, one would use either `git_oidmap_insert` to insert key/value pairs
      into a map or `git_oidmap_put` to insert a key only. These function have
      historically been macros, which is why their syntax is kind of weird: instead of
      returning an error code directly, they instead have to be passed a pointer to
      where the return value shall be stored. This does not match libgit2's common
      idiom of directly returning error codes.Furthermore, `git_oidmap_put` is tightly
      coupled with implementation details of the map as it exposes the index of
      inserted entries.
      
      Introduce a new function `git_oidmap_set`, which takes as parameters the map,
      key and value and directly returns an error code. Convert all trivial callers of
      `git_oidmap_insert` and `git_oidmap_put` to make use of it.
      Patrick Steinhardt committed
    • oidmap: introduce high-level getter for values · 9694ef20
      The current way of looking up an entry from a map is tightly coupled with the
      map implementation, as one first has to look up the index of the key and then
      retrieve the associated value by using the index. As a caller, you usually do
      not care about any indices at all, though, so this is more complicated than
      really necessary. Furthermore, it invites for errors to happen if the correct
      error checking sequence is not being followed.
      
      Introduce a new high-level function `git_oidmap_get` that takes a map and a key
      and returns a pointer to the associated value if such a key exists. Otherwise,
      a `NULL` pointer is returned. Adjust all callers that can trivially be
      converted.
      Patrick Steinhardt committed
    • maps: use uniform lifecycle management functions · 351eeff3
      Currently, the lifecycle functions for maps (allocation, deallocation, resize)
      are not named in a uniform way and do not have a uniform function signature.
      Rename the functions to fix that, and stick to libgit2's naming scheme of saying
      `git_foo_new`. This results in the following new interface for allocation:
      
      - `int git_<t>map_new(git_<t>map **out)` to allocate a new map, returning an
        error code if we ran out of memory
      
      - `void git_<t>map_free(git_<t>map *map)` to free a map
      
      - `void git_<t>map_clear(git<t>map *map)` to remove all entries from a map
      
      This commit also fixes all existing callers.
      Patrick Steinhardt committed
  22. 22 Jan, 2019 1 commit
  23. 01 Dec, 2018 1 commit
  24. 28 Nov, 2018 1 commit
  25. 01 Oct, 2018 1 commit
  26. 22 Jun, 2018 2 commits
  27. 10 Jun, 2018 1 commit
  28. 02 Mar, 2017 1 commit
  29. 17 Feb, 2017 6 commits