1. 24 Jun, 2019 5 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: 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 Mar, 2019 1 commit
  3. 02 Jan, 2019 1 commit
    • hash: convert `global_init` macros to real function · 03dc6480
      The `git_hash_global_init` function is simply defined as a macro to zero
      for most of the different hash implementations. This makes it impossible
      to treat it like a function pointer, which is required for a later
      commit where we want to improve the way global initialization works.
      Fix the issue by converting all no-op macros to an inline function
      returning zero.
      
      There's a small gotcha here, though: as most hash implementations only
      have a header file, but not a corresponding implementation file, we
      cannot declare the function as non-static. But declaring it as `static
      inline` fails, too, as there is a previous declaration as non-static. So
      we have to move the function declaration after the include that brings
      in the function definition, as it is allowed to have a non-static
      declaration after a static definition, but not the other way round.
      Patrick Steinhardt committed
  4. 11 Apr, 2018 1 commit
  5. 01 Feb, 2018 1 commit
  6. 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
  7. 03 Mar, 2017 2 commits
  8. 24 Oct, 2014 1 commit
  9. 17 Sep, 2013 1 commit
    • Add simple global shutdown hooks · a3aa5f4d
      Increasingly there are a number of components that want to do some
      cleanup at global shutdown time (at least if there are not going
      to be memory leaks).  This creates a very simple system of shutdown
      hooks that will be invoked by git_threads_shutdown.  Right now, the
      maximum number of hooks is hardcoded, but since adding a hook is
      not a public API, it should be fine and I thought it was better to
      start off with really simple code.
      Russell Belfer committed
  10. 26 Feb, 2013 1 commit
  11. 25 Feb, 2013 1 commit
  12. 08 Jan, 2013 2 commits
  13. 13 Nov, 2012 4 commits
  14. 13 Feb, 2012 1 commit
  15. 18 Sep, 2011 1 commit
    • Cleanup legal data · bb742ede
      1. The license header is technically not valid if it doesn't have a
      copyright signature.
      
      2. The COPYING file has been updated with the different licenses used in
      the project.
      
      3. The full GPLv2 header in each file annoys me.
      Vicent Marti committed
  16. 06 Dec, 2010 1 commit
  17. 30 Dec, 2008 1 commit
    • Add some routines for SHA1 hash computation · 007e0753
      [sp: Changed signature for output to use git_oid, and added
           a test case to verify an allocated git_hash_ctx can be
           reinitialized and reused.]
      
      Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
      Ramsay Jones committed