1. 09 Feb, 2018 3 commits
  2. 02 Feb, 2018 8 commits
  3. 20 Dec, 2017 2 commits
    • odb_loose: reject objects that cannot fit in memory · 3e6533ba
      Check the size of objects being read from the loose odb backend and
      reject those that would not fit in memory with an error message that
      reflects the actual problem, instead of error'ing later with an
      unintuitive error message regarding truncation or invalid hashes.
      Edward Thomson committed
    • odb: support large loose objects · ddefea75
      zlib will only inflate/deflate an `int`s worth of data at a time.
      We need to loop through large files in order to ensure that we inflate
      the entire file, not just an `int`s worth of data.  Thankfully, we
      already have this loop in our `git_zstream` layer.  Handle large objects
      using the `git_zstream`.
      Edward Thomson committed
  4. 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
  5. 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
  6. 01 May, 2017 1 commit
  7. 28 Feb, 2017 3 commits
  8. 29 Dec, 2016 1 commit
  9. 04 Aug, 2016 2 commits
  10. 26 May, 2016 1 commit
  11. 02 May, 2016 1 commit
    • odb_loose: fix undefined behavior when computing size · 7f407710
      An object's size is computed by reading the object header's size
      field until the most significant bit is not set anymore. To get
      the total size, we increase the shift on each iteration and add
      the shifted value to the total size.
      
      We read the current value into a variable of type `unsigned
      char`, from which we then take all bits except the most
      significant bit and shift the result. We will end up with a
      maximum shift of 60, but this exceeds the width of the value's
      type, resulting in undefined behavior.
      
      Fix the issue by instead reading the values into a variable of
      type `unsigned long`, which matches the required width. This is
      equivalent to git.git, which uses an `unsigned long` as well.
      Patrick Steinhardt committed
  12. 07 Mar, 2016 1 commit
  13. 17 Sep, 2015 1 commit
    • git_futils_mkdir_*: make a relative-to-base mkdir · ac2fba0e
      Untangle git_futils_mkdir from git_futils_mkdir_ext - the latter
      assumes that we own everything beneath the base, as if it were
      being called with a base of the repository or working directory,
      and is tailored towards checkout and ensuring that there is no
      bogosity beneath the base that must be cleaned up.
      
      This is (at best) slow and (at worst) unsafe in the larger context
      of a filesystem where we do not own things and cannot do things like
      unlink symlinks that are in our way.
      Edward Thomson committed
  14. 13 May, 2015 1 commit
    • odb: make the writestream's size a git_off_t · 77b339f7
      Restricting files to size_t is a silly limitation. The loose backend
      writes to a file directly, so there is no issue in using 63 bits for the
      size.
      
      We still assume that the header is going to fit in 64 bytes, which does
      mean quite a bit smaller files due to the run-length encoding, but it's
      still a much larger size than you would want Git to handle.
      Carlos Martín Nieto committed
  15. 13 Feb, 2015 2 commits
  16. 05 Dec, 2014 1 commit
  17. 16 Sep, 2014 1 commit
  18. 05 May, 2014 1 commit
  19. 05 Mar, 2014 1 commit
  20. 04 Mar, 2014 1 commit
  21. 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
    • 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
  22. 05 Nov, 2013 2 commits
  23. 04 Nov, 2013 1 commit