1. 03 Aug, 2020 1 commit
  2. 13 Jul, 2020 1 commit
    • config_entries: Avoid excessive map operations · f2400a9c
      When appending config entries, we currently always first get the
      currently existing map entry and then afterwards update the map to
      contain the current config value. In the common scenario where keys
      aren't being overridden, this is the best we can do. But in case a key
      gets set multiple times, then we'll also perform these two map
      operations. In extreme cases, hashing the map keys will thus start to
      dominate performance.
      
      Let's optimize the pattern by using a separately allocated map entry.
      Currently, we always put the current list entry into the map and update
      it to get any overridden multivar. As these list entries are also used
      to iterate config entries, we cannot update them in-place in the map and
      are thus forced to always set the map to contain the new entry. But with
      a separately allocated map entry, we can now create one once per config
      key and insert it into the map. Whenever appending a new config value
      with the same key, we can now just update the map entry in-place instead
      of having to replace the map entry completely.
      
      This reduces calls to the hashing function by half and trades the
      improved runtime for one more allocation per unique config key. Given
      that the refactoring arguably improves code readability by splitting
      concerns of the `config_entry_list` type and not having to track it in
      two different structures, this alone would already be reason enough to
      take the trade.
      
      Given a pathological case of a gitconfig with 100.000 repeated keys and
      a section of length 10.000 characters, this reduces runtime by half from
      approximately 14 seconds to 7 seconds as expected.
      Patrick Steinhardt committed
  3. 12 Jul, 2020 15 commits
  4. 09 Jul, 2020 3 commits
  5. 02 Jul, 2020 1 commit
  6. 01 Jul, 2020 3 commits
  7. 30 Jun, 2020 3 commits
    • Make NTLMClient Memory and UndefinedBehavior Sanitizer-clean · 7c964416
      This change makes the code pass the libgit2 tests cleanly when
      MSan/UBSan are enabled. Notably:
      
      * Changes malloc/memset combos into calloc for easier auditing.
      * Makes `write_buf` return early if the buffer length is empty to avoid
        arithmetic with NULL pointers (which UBSan does not like).
      * Initializes a few arrays that were sometimes being read before being
        written to.
      lhchavez committed
    • Make the tests pass cleanly with MemorySanitizer · 3a197ea7
      This change:
      
      * Initializes a few variables that were being read before being
        initialized.
      * Includes https://github.com/madler/zlib/pull/393. As such,
        it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
      lhchavez committed
    • Make the tests run cleanly under UndefinedBehaviorSanitizer · d0656ac8
      This change makes the tests run cleanly under
      `-fsanitize=undefined,nullability` and comprises of:
      
      * Avoids some arithmetic with NULL pointers (which UBSan does not like).
      * Avoids an overflow in a shift, due to an uint8_t being implicitly
        converted to a signed 32-bit signed integer after being shifted by a
        32-bit signed integer.
      * Avoids a unaligned read in libgit2.
      * Ignores unaligned reads in the SHA1 library, since it only happens on
        Intel processors, where it is _still_ undefined behavior, but the
        semantics are moderately well-understood.
      
      Of notable omission is `-fsanitize=integer`, since there are lots of
      warnings in zlib and the SHA1 library which probably don't make sense to
      fix and I could not figure out how to silence easily. libgit2 itself
      also has ~100s of warnings which are mostly innocuous (e.g. use of enum
      constants that only fit on an `uint32_t`, but there is no way to do that
      in a simple fashion because the data type chosen for enumerated types is
      implementation-defined), and investigating whether there are worrying
      warnings would need reducing the noise significantly.
      lhchavez committed
  8. 27 Jun, 2020 1 commit
  9. 26 Jun, 2020 1 commit
    • Review feedback · eab2b044
      * Change the default of the file limit to 0 (unlimited).
      * Changed the heuristic to close files to be the file that contains the
        least-recently-used window such that the window is the
        most-recently-used in the file, and the file does not have in-use
        windows.
      * Parameterized the filelimit test to check for a limit of 1 and 100
        open windows.
      lhchavez committed
  10. 23 Jun, 2020 1 commit
  11. 21 Jun, 2020 1 commit
    • mwindow: set limit on number of open files · 9679df57
      There are some cases in which repositories accrue a large number of
      packfiles. The existing mwindow limit applies only to the total size of
      mmap'd files, not on their number. This leads to a situation in which
      having lots of small packfiles could exhaust the allowed number of open
      files, particularly on macOS, where the default ulimit is very low
      (256).
      
      This change adds a new configuration parameter
      (GIT_OPT_SET_MWINDOW_FILE_LIMIT) that sets the maximum number of open
      packfiles, with a default of 128. This is low enough so that even macOS
      users should not hit it during normal use.
      
      Based on PR #5386, originally written by @josharian.
      
      Fixes: #2758
      lhchavez committed
  12. 17 Jun, 2020 5 commits
  13. 16 Jun, 2020 2 commits
    • Merge pull request #5550 from libgit2/ethomson/github_actions · d60bf002
      Introduce CI with GitHub Actions
      Edward Thomson committed
    • Introduce CI with GitHub Actions · 47fb33ba
      Add CI using GitHub Actions and GitHub Packages:
      
      * This moves our Linux build containers into GitHub Packages; we will
        identify the most recent commit that updated the docker descriptions,
        and then look for a docker image in libgit2's GitHub Packages registry
        for a container with the tag corresponding to that description.  If
        there is not one, we will build the container and then push it to
        GitHub Packages.
      
      * We no longer need to manage authentication with our own credentials or
        PAT tokens.  GitHub Actions provides a GITHUB_TOKEN that can publish
        artifacts, packages and commits to our repository within a workflow
        run.
      
      * We will use a matrix to build our various CI steps.  This allows us
        to keep configuration in a single place without multiple YAML files.
      Edward Thomson committed
  14. 13 Jun, 2020 1 commit
  15. 12 Jun, 2020 1 commit