1. 25 May, 2020 1 commit
  2. 23 May, 2020 4 commits
  3. 16 May, 2020 2 commits
    • checkout: fix file being treated as unmodified due to racy index · 3f201f75
      When trying to determine whether a file changed, we try to avoid heavy
      operations by fist taking a look at the index, seeing whether the index
      entry is modified already. This doesn't seem to cut it, though, as we
      currently have the racy checkout::index::can_disable_pathspec_match test
      case: sometimes the files get restored to their original contents,
      sometimes they aren't.
      
      The issue is caused by a racy index [1]: in case we modify a file, add
      it to the index and then modify it again in-place without changing its
      file, then we may end up with a modified file that has the same stat(3P)
      info as we've currently got it in its corresponding index entry. The
      mitigation for this is to treat files with the same mtime as the index
      are treated as racily modified. We already have this logic in place for
      the index, but not when doing a checkout.
      
      Fix the issue by only consulting the index entry in case it has an older
      mtime as the index. Previously, the following script reliably had at
      least 20 failures, while now there is no failure to be observed anymore:
      
      ```bash
      j=0
      for i in $(seq 100)
      do
      	if ! ./libgit2_clar -scheckout::index::can_disable_pathspec_match >/dev/null
      	then
      		j=$(($j + 1))
      	fi
      done
      echo "Failures: $j"
      ```
      
      [1]: https://git-scm.com/docs/racy-git
      Patrick Steinhardt committed
    • tests: checkout: fix stylistic issues and static variable · 915f8860
      The test case checkout::index::can_disable_pathspec_match has some
      shortcomings when it comes to coding style, which didn't fit our own
      coding style. Furthermore, it had an unnecessary static local variable.
      
      The test has been refactored to address these issues.
      Patrick Steinhardt committed
  4. 15 May, 2020 2 commits
    • cmake: Sort source files for reproducible builds · b85eefb4
      We currently use `FILE(GLOB ...)` in most places to find source and
      header files. This is problematic in that the order of files returned
      depends on the operating system's directory iteration order and may thus
      not be deterministic. As a result, we link object files in unspecified
      order, which may cause the linker to emit different code across runs.
      
      Fix this issue by sorting all code used as input to the libgit2 library
      to improve the reliability of reproducible builds.
      Patrick Steinhardt committed
    • streams: openssl: fix memleak due to us not free'ing certs · b43a9e66
      When creating a `git_cert` from the OpenSSL X509 certificate of a given
      stream, we do not call `X509_free()` on the certificate, leading to a
      memory leak as soon as the certificate is requested e.g. by the
      certificate check callback.
      
      Fix the issue by properly calling `X509_free()`.
      Patrick Steinhardt committed
  5. 12 May, 2020 7 commits
  6. 11 May, 2020 9 commits
  7. 10 May, 2020 8 commits
  8. 25 Apr, 2020 1 commit
  9. 19 Apr, 2020 1 commit
  10. 14 Apr, 2020 2 commits
  11. 05 Apr, 2020 3 commits
    • docs: add documentation for our coding style · ffb6a576
      For years, we've repeatedly had confusion about what our actual coding
      style is not only for newcomers, but also across the core contributors.
      This can mostly be attributed to the fact that we do not have any coding
      conventions written down. This is now a thing of the past with the
      introduction of a new document that gives an initial overview of our
      style and most important best practices for both our C codebase as well
      as for CMake.
      
      While the proposed coding style for our C codebase should be rather
      uncontroversial, the coding style for CMake might be. This can be
      attributed to multiple facts. First, the CMake code base doesn't really
      have any uniform coding style and is quite outdated in a lot of places.
      Second, the proposed coding style actually breaks with our existing one:
      we currently use all-uppercase function names and variables, but the
      documented coding style says we use all-lowercase function names but
      all-uppercase variables.
      
      It's common practice in CMake to write variables in all upper-case, and
      in fact all variables made available by CMake are exactly that. As
      variables are case-sensitive in CMake, we cannot and shouldn't break
      with this. In contrast, function calls are case insensitive, and modern
      CMake always uses all-lowercase ones. I argue we should do the same to
      get in line with other codebases and to reduce the likelihood of
      repetitive strain injuries.
      
      So especially for CMake, the proposed coding style says something we
      don't have yet. I'm fine with that, as the document explicitly says that
      it's what we want to have and not what we have right now.
      Patrick Steinhardt committed
    • Merge pull request #5485 from libgit2/ethomson/sysdir_unused · e9b0cfc0
      sysdir: remove unused git_sysdir_get_str
      Patrick Steinhardt committed