1. 21 Mar, 2017 1 commit
    • odb_pack: initialize `git_rawobj` structure · 8d452448
      The `pack_entry_find_prefix` function receives a `git_rawobj` structure
      as argument. While the function first initializes the structure to a
      sensible state, Coverity is unable to correctly detect this, resulting
      in a warning.
      
      Fix this warning by initializing the object to all-zeroes before passing
      it to the function.
      Patrick Steinhardt committed
  2. 04 Aug, 2016 3 commits
  3. 26 May, 2016 1 commit
  4. 07 Mar, 2016 1 commit
  5. 14 Oct, 2015 1 commit
    • odb: Be smarter when refreshing backends · 43820f20
      In the current implementation of ODB backends, each backend is tasked
      with refreshing itself after a failed lookup. This is standard Git
      behavior: we want to e.g. reload the packfiles on disk in case they have
      changed and that's the reason we can't find the object we're looking
      for.
      
      This behavior, however, becomes pathological in repositories where
      multiple alternates have been loaded. Given that each alternate counts
      as a separate backend, a miss in the main repository (which can
      potentially be very frequent in cases where object storage comes from
      the alternate) will result in refreshing all its packfiles before we
      move on to the alternate backend where the object will most likely be
      found.
      
      To fix this, the code in `odb.c` has been refactored as to perform the
      refresh of all the backends externally, once we've verified that the
      object is nowhere to be found.
      
      If the refresh is successful, we then perform the lookup sequentially
      through all the backends, skipping the ones that we know for sure
      weren't refreshed (because they have no refresh API).
      
      The on-disk pack backend has been adjusted accordingly: it no longer
      performs refreshes internally.
      Vicent Marti committed
  6. 09 Jun, 2015 1 commit
  7. 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
  8. 21 Apr, 2014 1 commit
  9. 04 Mar, 2014 1 commit
  10. 11 Dec, 2013 2 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
    • Improve GIT_EUSER handling · 96869a4e
      This adds giterr_user_cancel to return GIT_EUSER and clear any
      error message that is sitting around.  As a result of using that
      in places, we need to be more thorough with capturing errors that
      happen inside a callback when used internally.  To help with that,
      this also adds giterr_capture and giterr_restore so that when we
      internally use a foreach-type function that clears errors and
      converts them to GIT_EUSER, it is easier to restore not just the
      return value, but the actual error message text.
      Russell Belfer committed
  11. 07 Nov, 2013 1 commit
  12. 30 Oct, 2013 1 commit
    • indexer: remove the stream infix · a6154f21
      It was there to keep it apart from the one which read in from a file on
      disk. This other indexer does not exist anymore, so there is no need for
      anything other than git_indexer to refer to it.
      
      While here, rename _add() function to _append() and _finalize() to
      _commit(). The former change is cosmetic, while the latter avoids
      talking about "finalizing", which OO languages use to mean something
      completely different.
      Carlos Martín Nieto committed
  13. 04 Oct, 2013 1 commit
  14. 03 Oct, 2013 1 commit
    • Initial iconv hookup for precomposed unicode · 219d3457
      This hooks up git_path_direach and git_path_dirload so that they
      will take a flag indicating if directory entry names should be
      tested and converted from decomposed unicode to precomposed form.
      This code will only come into play on the Apple platform and even
      then, only when certain types of filesystems are used.
      
      This involved adding a flag to these functions which involved
      changing a lot of places in the code.
      
      This was an opportunity to do a bit of code cleanup here and there,
      for example, getting rid of the git_futils_cleanupdir_r function in
      favor of a simple flag to git_futils_rmdir_r to not remove the top
      level entry.  That ended up adding depth tracking during rmdir_r
      which led to a safety check for infinite directory recursion.  Yay.
      
      This hasn't actually been tested on the Mac filesystems where the
      issue occurs.  I still need to get test environment for that.
      Russell Belfer committed
  15. 10 Sep, 2013 1 commit
  16. 04 Sep, 2013 1 commit
    • odb: Move the auto refresh logic to the pack backend · b1a6c316
      Previously, `git_object_read()`, `git_object_read_prefix()` and
      `git_object_exists()` were implementing an auto refresh logic. When the
      expected object couldn't be found in any backend, a call to
      `git_odb_refresh()` was triggered and the lookup was once again performed
      against all backends.
      
      This commit removes this auto-refresh logic from the odb layer and pushes
      it down into the pack-backend (as it's the only one currently exposing
      a `refresh()` endpoint).
      nulltoken committed
  17. 30 Aug, 2013 1 commit
  18. 08 Aug, 2013 1 commit
  19. 22 Apr, 2013 1 commit
  20. 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
  21. 17 Mar, 2013 1 commit
  22. 15 Mar, 2013 1 commit
  23. 12 Jan, 2013 1 commit
  24. 11 Jan, 2013 2 commits
  25. 10 Jan, 2013 2 commits
  26. 08 Jan, 2013 1 commit
  27. 02 Dec, 2012 1 commit
  28. 30 Nov, 2012 1 commit
  29. 27 Nov, 2012 1 commit
  30. 05 Nov, 2012 1 commit
  31. 19 Sep, 2012 3 commits
  32. 14 Sep, 2012 1 commit
    • odb_pack: fix race condition · 3d7617e4
      last_found is the last packfile a wanted object was found in. Since
      last_found is shared among all searching threads, it might changes while
      we're searching. As suggested by @arrbee, put a copy on the stack to fix
      the race condition.
      Michael Schubert committed
  33. 12 Sep, 2012 1 commit
    • odb_pack: try lookup before refreshing packs · ab8a0402
      This reduces the rate of syscalls for the common case of sequences of
      object reads from the same pack.
      
      Best of 5 timings for libgit2_clar before this patch:
      real    0m5.375s
      user    0m0.392s
      sys     0m3.564s
      
      After applying this patch:
      real    0m5.285s
      user    0m0.356s
      sys     0m3.544s
      
      0.6% improvement in system time.
      9.2% improvement in user time.
      1.7% improvement in elapsed time.
      
      Confirmed a 0.6% reduction in number of system calls with strace.
      
      Expect greater improvement for graph-traversal with large packs.
      David Michael Barr committed