1. 24 Jun, 2019 6 commits
    • hash: add ability to distinguish algorithms · b7187ed7
      Create an enum that allows us to distinguish between different
      hashing algorithms. This enum is embedded into each
      `git_hash_ctx` and will instruct the code to which hashing
      function the particular request shall be dispatched.
      
      As we do not yet have multiple hashing algorithms, we simply
      initialize the hash algorithm to always be SHA1. At a later
      point, we will have to extend the `git_hash_init_ctx` function to
      get as parameter which algorithm shall be used.
      Patrick Steinhardt committed
    • hash: move SHA1 implementations to its own hashing context · 8832172e
      Create a separate `git_hash_sha1_ctx` structure that is specific
      to the SHA1 implementation and move all SHA1 functions over to
      use that one instead of the generic `git_hash_ctx`. The
      `git_hash_ctx` for now simply has a union containing this single
      SHA1 implementation, only, without any mechanism to distinguish
      between different algortihms.
      Patrick Steinhardt committed
    • hash: split into generic and SHA1-specific interface · d46d3b53
      As a preparatory step to allow multiple hashing APIs to exist at
      the same time, split the hashing functions into one layer for generic
      hashing and one layer for SHA1-specific hashing. Right now, this is
      simply an additional indirection layer that doesn't yet serve any
      purpose. In the future, the generic API will be extended to allow for
      choosing which hash to use, though, by simply passing an enum to the
      hash context initialization function. This is necessary as a first step
      to be ready for Git's move to SHA256.
      Patrick Steinhardt committed
    • hash: move SHA1 implementations into 'sha1/' folder · fda20622
      As we will include additional hash algorithms in the future due
      to upstream git discussing a move away from SHA1, we should
      accomodate for that and prepare for the move. As a first step,
      move all SHA1 implementations into a common subdirectory.
      
      Also, create a SHA1-specific header file that lives inside the
      hash folder. This header will contain the SHA1-specific header
      includes, function declarations and the SHA1 context structure.
      Patrick Steinhardt committed
    • hash: introduce source files to break include circles · bd48bf3f
      The hash source files have circular include dependencies right
      now, which shows by our broken generic hash implementation. The
      "hash.h" header declares two functions and the `git_hash_ctx`
      typedef before actually including the hash backend header and can
      only declare the remaining hash functions after the include due
      to possibly static function declarations inside of the
      implementation includes.
      
      Let's break this cycle and help maintainability by creating a
      real implementation file for each of the hash implementations.
      Instead of relying on the exact include order, we now especially
      avoid the use of `GIT_INLINE` for function declarations.
      Patrick Steinhardt committed
    • hash: move `git_hash_prov` into Win32 backend · bbf034ab
      The structure `git_hash_prov` is only ever used by the Win32 SHA1
      backend. As such, it doesn't make much sense to expose it via the
      generic "hash.h" header, as it is an implementation detail of the Win32
      backend only. Move the typedef of `git_hash_prov` into
      "hash/sha1/win32.h" to fix this.
      Patrick Steinhardt committed
  2. 23 Jun, 2019 2 commits
  3. 21 Jun, 2019 1 commit
  4. 20 Jun, 2019 2 commits
  5. 17 Jun, 2019 2 commits
  6. 16 Jun, 2019 5 commits
  7. 15 Jun, 2019 17 commits
  8. 14 Jun, 2019 5 commits
    • Merge pull request #5114 from pks-t/pks/bigfile-refactoring · f0a720d5
      Removal of `p_fallocate`
      Edward Thomson committed
    • posix: remove `p_fallocate` abstraction · 2d85c7e8
      By now, we have repeatedly failed to provide a nice
      cross-platform implementation of `p_fallocate`. Recent tries to
      do that escalated quite fast to a set of different CMake checks,
      implementations, fallbacks, etc., which started to look real
      awkward to maintain. In fact, `p_fallocate` had only been
      introduced in commit 4e3949b7 (tests: test that largefiles can
      be read through the tree API, 2019-01-30) to support a test with
      large files, but given the maintenance costs it just seems not to
      be worht it.
      
      As we have removed the sole user of `p_fallocate` in the previous
      commit, let's drop it altogether.
      Patrick Steinhardt committed
    • tests: object: refactor largefile test to not use `p_fallocate` · 0c2d0d4b
      The `p_fallocate` platform is currently in use in our tests,
      only, but it proved to be quite burdensome to get it implemented
      in a cross-platform way. The only "real" user is the test
      object::tree::read::largefile, where it's used to allocate a
      large file in the filesystem only to commit it to the repo and
      read its object back again. We can simplify this quite a bit by
      just using an in-memory buffer of 4GB. Sure, this cannot be used
      on platforms with low resources. But creating 4GB files is not
      any better, and we already skip the test if the environment
      variable "GITTEST_INVASIVE_FS_SIZE" is not set. So we're arguably
      not worse off than before.
      Patrick Steinhardt committed
    • Merge pull request #5055 from tiennou/cmake/backend-detect · c3179eff
      Modularize our TLS & hash detection
      Patrick Steinhardt committed
    • cmake: Modulize our TLS & hash detection · 94fc83b6
      The interactions between `USE_HTTPS` and `SHA1_BACKEND` have been
      streamlined. Previously we would have accepted not quite working
      configurations (like, `-DUSE_HTTPS=OFF -DSHA1_BACKEND=OpenSSL`) and, as
      the OpenSSL detection only ran with `USE_HTTPS`, the link would fail.
      
      The detection was moved to a new `USE_SHA1`, modeled after `USE_HTTPS`,
      which takes the values "CollisionDetection/Backend/Generic", to better
      match how the "hashing backend" is selected, the default (ON) being
      "CollisionDetection".
      
      Note that, as `SHA1_BACKEND` is still used internally, you might need to
      check what customization you're using it for.
      Etienne Samson committed