1. 12 Feb, 2023 1 commit
  2. 09 Jul, 2022 1 commit
  3. 10 Apr, 2022 1 commit
  4. 23 Feb, 2022 1 commit
  5. 27 Aug, 2021 2 commits
  6. 27 Jul, 2021 1 commit
  7. 06 Dec, 2020 1 commit
  8. 29 Nov, 2020 1 commit
    • Make the pack and mwindow implementations data-race-free · 322c15ee
      This change fixes a packfile heap corruption that can happen when
      interacting with multiple packfiles concurrently across multiple
      threads. This is exacerbated by setting a lower mwindow open file limit.
      
      This change:
      
      * Renames most of the internal methods in pack.c to clearly indicate
        that they expect to be called with a certain lock held, making
        reasoning about the state of locks a bit easier.
      * Splits the `git_pack_file` lock in two: the one in `git_pack_file`
        only protects the `index_map`. The protection to `git_mwindow_file` is
        now in that struct.
      * Explicitly checks for freshness of the `git_pack_file` in
        `git_packfile_unpack_header`: this allows the mwindow implementation
        to close files whenever there is enough cache pressure, and
        `git_packfile_unpack_header` will reopen the packfile if needed.
      * After a call to `p_munmap()`, the `data` and `len` fields are poisoned
        with `NULL` to make use-after-frees more evident and crash rather than
        being open to the possibility of heap corruption.
      * Adds a test case to prevent this from regressing in the future.
      
      Fixes: #5591
      lhchavez committed
  9. 27 Nov, 2020 1 commit
  10. 05 Oct, 2020 1 commit
  11. 01 Apr, 2020 1 commit
  12. 09 Jan, 2020 1 commit
  13. 25 Nov, 2019 1 commit
  14. 15 Feb, 2019 1 commit
    • 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
  15. 01 Dec, 2018 1 commit
  16. 10 Jun, 2018 1 commit
    • pack: rename `git_packfile_stream_free` · c8ee5270
      The function `git_packfile_stream_free` frees all state of the packfile
      stream without freeing the structure itself. This naming makes it hard
      to spot whether it will try to free the pointer itself or not, causing
      potential future errors. Due to this reason, we have decided to name a
      function freeing state without freeing the actual struture a "dispose"
      function.
      
      Rename `git_packfile_stream_free` to `git_packfile_stream_dispose` as a
      first example following this rule.
      Patrick Steinhardt committed
  17. 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
  18. 21 Jan, 2017 1 commit
  19. 04 Aug, 2016 1 commit
  20. 13 Jan, 2016 1 commit
  21. 11 Mar, 2015 1 commit
  22. 15 Feb, 2015 1 commit
  23. 23 Jun, 2014 1 commit
    • Share packs across repository instances · b3b66c57
      Opening the same repository multiple times will currently open the same
      file multiple times, as well as map the same region of the file multiple
      times. This is not necessary, as the packfile data is immutable.
      
      Instead of opening and closing packfiles directly, introduce an
      indirection and allocate packfiles globally. This does mean locking on
      each packfile open, but we already use this lock for the global mwindow
      list so it doesn't introduce a new contention point.
      Carlos Martín Nieto committed
  24. 13 May, 2014 1 commit
  25. 09 May, 2014 2 commits
    • pack: use a cache for delta bases when unpacking · a332e91c
      Bring back the use of the delta base cache for unpacking objects. When
      generating the delta chain, we stop when we find a delta base in the
      pack's cache and use that as the starting point.
      Carlos Martín Nieto committed
    • pack: unpack using a loop · 2acdf4b8
      We currently make use of recursive function calls to unpack an object,
      resolving the deltas as we come back down the chain. This means that we
      have unbounded stack growth as we look up objects in a pack.
      
      This is now done in two steps: first we figure out what the dependency
      chain is by looking up the delta bases until we reach a non-delta
      object, pushing the information we need onto a stack and then we pop
      from that stack and apply the deltas until there are no more left.
      
      This version of the code does not make use of the delta base cache so it
      is slower than what's in the mainline. A later commit will reintroduce
      it.
      Carlos Martín Nieto committed
  26. 23 Jan, 2014 1 commit
  27. 01 Nov, 2013 2 commits
  28. 04 Oct, 2013 1 commit
  29. 22 Apr, 2013 3 commits
    • Consolidate packfile allocation further · 5d2d21e5
      Rename git_packfile_check to git_packfile_alloc since it is now
      being used more in that capacity.  Fix the various places that use
      it.  Consolidate some repeated code in odb_pack.c related to the
      allocation of a new pack_backend.
      Russell Belfer committed
    • Further threading fixes · 53607868
      This builds on the earlier thread safety work to make it so that
      setting the odb, index, refdb, or config for a repository is done
      in a threadsafe manner with minimized locking time.  This is done
      by adding a lock to the repository object and using it to guard
      the assignment of the above listed pointers.  The lock is only
      held to assign the pointer value.
      
      This also contains some minor fixes to the other work with pack
      files to reduce the time that locks are being held to and fix an
      apparently memory leak.
      Russell Belfer committed
    • Add mutex around mapping and unmapping pack files · 24c70804
      When I was writing threading tests for the new cache, the main
      error I kept running into was a pack file having it's content
      unmapped underneath the running thread.  This adds a lock around
      the routines that map and unmap the pack data so that threads can
      effectively reload the data when they need it.
      
      This also required reworking the error handling paths in a couple
      places in the code which I tried to make consistent.
      Russell Belfer committed
  30. 03 Mar, 2013 1 commit
  31. 12 Jan, 2013 1 commit
  32. 11 Jan, 2013 4 commits