1. 15 Jul, 2017 4 commits
    • config_file: remove unused backend field from parse data · 56a7a264
      The backend passed to `config_read` is never actually used anymore, so
      we can remove it from the function and the `parse_data` structure.
      Patrick Steinhardt committed
    • config_file: pass reader directly to callbacks · 3a7f7a6e
      Previously, the callbacks passed to `config_parse` got the reader via a
      pointer to a pointer. This allowed the callbacks to update the callers
      `reader` variable when the array holding it has been reallocated. As the
      array is no longer present, we can simply the code by making the reader
      a simple pointer.
      Patrick Steinhardt committed
    • config_file: refactor include handling · 73df75d8
      Current code for configuration files uses the `reader` structure to
      parse configuration files and store additional metadata like the file's
      path and checksum. These structures are stored within an array in the
      backend itself, which causes multiple problems.
      
      First, it does not make sense to keep around the file's contents with
      the backend itself. While this data is usually free'd before being added
      to the backend, this brings along somewhat intricate lifecycle problems.
      A better solution would be to store only the file paths as well as the
      checksum of the currently parsed content only.
      
      The second problem is that the `reader` structures are stored inside an
      array. When re-parsing configuration files due to changed contents, we
      may cause this array to be reallocated, requiring us to update pointers
      hold by callers. Furthermore, we do not keep track of includes which
      are already associated to a reader inside of this array. This causes us
      to add readers multiple times to the backend, e.g. in the scenario of
      refreshing configurations.
      
      This commit fixes these shortcomings. We introduce a split between the
      parsing data and the configuration file's metadata. The `reader` will
      now only hold the file's contents and the parser state and the new
      `config_file` structure holds the file's path and checksum. Furthermore,
      the new structure is a recursive structure in that it will also hold
      references to the files it directly includes. The diskfile is changed to
      only store the top-level configuration file.
      
      These changes allow us further refactorings and greatly simplify
      understanding the code.
      Patrick Steinhardt committed
  2. 14 Jul, 2017 1 commit
  3. 12 Jul, 2017 1 commit
  4. 10 Jul, 2017 1 commit
  5. 07 Jul, 2017 1 commit
  6. 05 Jul, 2017 1 commit
    • tests: config: fix missing declaration causing error · 1f7af277
      On systems where we pull in our distributed version of the regex
      library, all tests in config::readonly fail. This error is actually
      quite interesting: the test suite is unable to find the declaration of
      `git_path_exists` and assumes it has a signature of `int
      git_path_exists(const char *)`. But actually, it has a `bool` return
      value. Due to this confusion, some wrong conversion is done by the
      compiler and the `cl_assert(!git_path_exists("file"))` checks
      erroneously fail, even when the function does in fact return the correct
      value.
      
      The error is actually introduced by 56893bb9 (cmake: consistently use
      TARGET_INCLUDE_DIRECTORIES if available, 2017-06-28), unfortunately
      introduced by myself. Due to the delayed addition of include
      directories, we will now find the "config.h" header inside of the
      "deps/regex" directory instead of inside the "src/" directory, where it
      should be. As such, we are missing definitions for the
      `git_config_file__ondisk` and `git_path_exists` symbols.
      
      The correct fix here would be to fix the order in which include search
      directories are added. But due to the current restructuring of
      CMakeBuild.txt, I'm refraining from doing so and delay the proper fix a
      bit. Instead, we paper over the issue by explicitly including "path.h"
      to fix its prototype. This ignores the issue that
      `git_config_file__ondisk` is undeclared, as its signature is correctly
      identified by the compiler.
      Patrick Steinhardt committed
  7. 30 Jun, 2017 1 commit
  8. 28 Jun, 2017 3 commits
  9. 27 Jun, 2017 2 commits
  10. 26 Jun, 2017 1 commit
  11. 23 Jun, 2017 7 commits
    • Convert port with htons() in p_getaddrinfo() · ef09eae1
      `sin_port` should be in network byte order.
      Ian Douglas Scott committed
    • tests: refs::crashes: create sandbox for creating symref · b6ed67c2
      The test `refs::crashes::double_free` operates on our in-source
      "testrepo.git" repository without creating a copy first. As the test
      will try to create a new symbolic reference, this will fail when we want
      to do a pure out-of-tree build with a read-only source tree.
      
      Fix the issue by creating a sandbox first.
      Patrick Steinhardt committed
    • tests: index::tests: create sandboxed repo for locking · 6ee7d37a
      The test `index::tests::can_lock_index` operates on the "testrepo.git"
      repository located inside of our source tree. While this is okay for
      tests which do read-only operations on these resouces, this specific
      test tries to lock the index by creating a lock. This will obviously
      fail on out-of-tree builds with read-only source trees.
      
      Fix the issue by creating a sandbox first.
      Patrick Steinhardt committed
    • cmake: generate clar.suite in binary directory · 4305fcca
      Change the output path of generate.py to generate the clar.suite file
      inside of the binary directory. This fixes out of tree builds with
      read-only source trees as we now refrain from writing anything into the
      source tree.
      Patrick Steinhardt committed
    • generate.py: generate clar cache in binary directory · 8d22bcea
      The source directory should usually not be touched when using
      out-of-tree builds. But next to the previously fixed "clar.suite" file, we
      are also writing the ".clarcache" into the project's source tree,
      breaking the builds. Fix this by also honoring the output directory for
      the ".clarcache" file.
      Patrick Steinhardt committed
    • generate.py: enable overriding path of generated clar.suite · 9e240bd2
      The generate.py script will currently always write the generated
      clar.suite file into the scanned directory, breaking out-of-tree builds
      with read-only source directories. Fix this issue by adding another
      option to allow overriding the output path of the generated file.
      Patrick Steinhardt committed
    • generate.py: disallow generating test suites for multiple paths · 0a513a94
      Our generate.py script is used to extract and write test suite
      declarations into the clar.suite file. As is, the script accepts
      multiple directories on the command line and will generate this file for
      each of these directories.
      
      The generate.py script will always write the clar.suite file into the
      directory which is about to be scanned. This actually breaks
      out-of-tree builds with libgit2, as the file will be generated in the
      source tree instead of in the build tree. This is noticed especially in
      the case where the source tree is mounted read-only, rendering us unable
      to build unit tests.
      
      Due to us accepting multiple paths which are to be scanned, it is not
      trivial to fix though. The first solution which comes into mind would be
      to re-create the directory hierarchy at a given output path or use
      unique names for the clar.suite files, but this is rather cumbersome and
      magical. The second and cleaner solution would be to fold all
      directories into a single clar.suite file, but this would probably break
      some use-cases.
      
      Seeing that we do not ever pass multiple directories to generate.py, we
      will now simply retire support for this. This allows us to later on
      introduce an additional option to specify the path where the clar.suite
      file will be generated at, defaulting to "clar.suite" inside of the
      scanned directory.
      Patrick Steinhardt committed
  12. 22 Jun, 2017 1 commit
    • cmake: Permit disabling external http-parser · 845f661d
      When attempting to build libgit2 as an isolated static lib, CMake
      gleefully attempts to use the system http-parser.  This is typically
      seen on Linux systems which install header files with every package,
      such as Gentoo.
      
      Allow developers to forcibly disable using the system http-parser with
      the config switch USE_EXT_HTTP_PARSER.  Defaults to ON to maintain
      previous behavior.
      
      Signed-off-by: Jason Cooper <jason@lakedaemon.net>
      Jason Cooper committed
  13. 21 Jun, 2017 8 commits
  14. 19 Jun, 2017 2 commits
  15. 17 Jun, 2017 1 commit
  16. 14 Jun, 2017 4 commits
  17. 13 Jun, 2017 1 commit