1. 03 Jan, 2018 8 commits
    • Merge pull request #4437 from pks-t/pks/openssl-hash-errors · a223bae5
      hash: openssl: check return values of SHA1_* functions
      Edward Thomson committed
    • Merge pull request #4462 from pks-t/pks/diff-generated-excessive-stats · 399c0b19
      diff_generate: avoid excessive stats of .gitattribute files
      Edward Thomson committed
    • diff_generate: avoid excessive stats of .gitattribute files · d8896bda
      When generating a diff between two trees, for each file that is to be
      diffed we have to determine whether it shall be treated as text or as
      binary files. While git has heuristics to determine which kind of diff
      to generate, users can also that default behaviour by setting or
      unsetting the 'diff' attribute for specific files.
      
      Because of that, we have to query gitattributes in order to determine
      how to diff the current files. Instead of hitting the '.gitattributes'
      file every time we need to query an attribute, which can get expensive
      especially on networked file systems, we try to cache them instead. This
      works perfectly fine for every '.gitattributes' file that is found, but
      we hit cache invalidation problems when we determine that an attribuse
      file is _not_ existing. We do create an entry in the cache for missing
      '.gitattributes' files, but as soon as we hit that file again we
      invalidate it and stat it again to see if it has now appeared.
      
      In the case of diffing large trees with each other, this behaviour is
      very suboptimal. For each pair of files that is to be diffed, we will
      repeatedly query every directory component leading towards their
      respective location for an attributes file. This leads to thousands or
      even hundreds of thousands of wasted syscalls.
      
      The attributes cache already has a mechanism to help in that scenario in
      form of the `git_attr_session`. As long as the same attributes session
      is still active, we will not try to re-query the gitmodules files at all
      but simply retain our currently cached results. To fix our problem, we
      can create a session at the top-most level, which is the initialization
      of the `git_diff` structure, and use it in order to look up the correct
      diff driver. As the `git_diff` structure is used to generate patches for
      multiple files at once, this neatly solves our problem by retaining the
      session until patches for all files have been generated.
      
      The fix has been tested with linux.git by calling
      `git_diff_tree_to_tree` and `git_diff_to_buf` with v4.10^{tree} and
      v4.14^{tree}.
      
                      | time    | .gitattributes stats
          without fix | 33.201s | 844614
          with fix    | 30.327s | 4441
      
      While execution only improved by roughly 10%, the stat(3) syscalls for
      .gitattributes files decreased by 99.5%. The benchmarks were quite
      simple with best-of-three timings on Linux ext4 systems. One can assume
      that for network based file systems the performance gain will be a lot
      larger due to a much higher latency.
      Patrick Steinhardt committed
    • Merge pull request #4439 from tiennou/fix/4352 · 30455a56
      cmake: create a dummy file for Xcode
      Patrick Steinhardt committed
    • streams: openssl: fix thread-safety for OpenSSL error messages · ba56f781
      The function `ERR_error_string` can be invoked without providing a
      buffer, in which case OpenSSL will simply return a string printed into a
      static buffer. Obviously and as documented in ERR_error_string(3), this
      is not thread-safe at all. As libgit2 is a library, though, it is easily
      possible that other threads may be using OpenSSL at the same time, which
      might lead to clobbered error strings.
      
      Fix the issue by instead using a stack-allocated buffer. According to
      the documentation, the caller has to provide a buffer of at least 256
      bytes of size. While we do so, make sure that the buffer will never get
      overflown by switching to `ERR_error_string_n` to specify the buffer's
      size.
      Patrick Steinhardt committed
    • hash: openssl: check return values of SHA1_* functions · 75e1737a
      The OpenSSL functions `SHA1_Init`, `SHA1_Update` and `SHA1_Final` all
      return 1 for success and 0 otherwise, but we never check their return
      values. Do so.
      Patrick Steinhardt committed
    • Merge pull request #4456 from libgit2/ethomson/treebuilder_docs · 4964aea0
      docs: git_treebuilder_insert validates entries
      Patrick Steinhardt committed
    • Merge pull request #4457 from libgit2/ethomson/tree_error_messages · 98303ea3
      tree: standard error messages are lowercase
      Patrick Steinhardt committed
  2. 01 Jan, 2018 1 commit
  3. 31 Dec, 2017 2 commits
  4. 30 Dec, 2017 6 commits
  5. 29 Dec, 2017 2 commits
  6. 28 Dec, 2017 1 commit
  7. 26 Dec, 2017 4 commits
  8. 23 Dec, 2017 7 commits
  9. 20 Dec, 2017 9 commits