1. 26 Dec, 2017 2 commits
  2. 23 Dec, 2017 1 commit
    • Fix unpack double free · c3514b0b
      If an element has been cached, but then the call to
      packfile_unpack_compressed() fails, the very next thing that happens is
      that its data is freed and then the element is not removed from the
      cache, which frees the data again.
      
      This change sets obj->data to NULL to avoid the double-free. It also
      stops trying to resolve deltas after two continuous failed rounds of
      resolution, and adds a test for this.
      lhchavez committed
  3. 15 Dec, 2017 1 commit
    • diff_file: properly refcount blobs when initializing file contents · 2388a9e2
      When initializing a `git_diff_file_content` from a source whose data is
      derived from a blob, we simply assign the blob's pointer to the
      resulting struct without incrementing its refcount. Thus, the structure
      can only be used as long as the blob is kept alive by the caller.
      
      Fix the issue by using `git_blob_dup` instead of a direct assignment.
      This function will increment the refcount of the blob without allocating
      new memory, so it does exactly what we want. As
      `git_diff_file_content__unload` already frees the blob when
      `GIT_DIFF_FLAG__FREE_BLOB` is set, we don't need to add new code
      handling the free but only have to set that flag correctly.
      Patrick Steinhardt committed
  4. 08 Dec, 2017 1 commit
  5. 06 Dec, 2017 1 commit
  6. 04 Dec, 2017 1 commit
  7. 30 Nov, 2017 1 commit
  8. 22 Nov, 2017 1 commit
  9. 19 Nov, 2017 1 commit
  10. 14 Nov, 2017 4 commits
  11. 13 Nov, 2017 1 commit
    • add test status codes legend to the 'Started' test trace · 19f37f97
      motivation: (for someone new to the tests) it's puzzling to find the odd 'S' interspersed in the test output
      
      proposed alternative test output (extract):
      
      $ cmake --build . && ./libgit2_clar -srepo -v
      ...
      Loaded 340 suites:
      Started (test status codes: OK='.' FAILURE='F' SKIPPED='S')
      
      repo::config...
      repo::discover..........
      repo::env.
      repo::getters...
      repo::hashfile..
      repo::head......................
      repo::headtree....
      repo::init.........................S
      repo::message..
      repo::new..
      repo::open.............
      repo::pathspec..........
      repo::reservedname.....
      repo::setters.....
      repo::shallow....
      repo::state.............
      Christine Poerschke committed
  12. 12 Nov, 2017 2 commits
  13. 11 Nov, 2017 2 commits
    • patch_parse: allow parsing ambiguous patch headers · 80226b5f
      The git patch format allows for having unquoted paths with whitespaces
      inside. This format becomes ambiguous to parse, e.g. in the following
      example:
      
          diff --git a/file b/with spaces.txt b/file b/with spaces.txt
      
      While we cannot parse this in a correct way, we can instead use the
      "---" and "+++" lines to retrieve the file names, as the path is not
      followed by anything here but spans the complete remaining line. Because
      of this, we can simply bail outwhen parsing the "diff --git" header here
      without an actual error and then proceed to just take the paths from the
      other headers.
      Patrick Steinhardt committed
    • clar: verify command line arguments before execute · 32758631
      When executing `libgit2_clar -smerge -invalid_option`, it will first execute
      the merge test suite and afterwards output help because of the invalid option.
      
      With this changa, it verifies all options before execute. If there are any
      invalid options, it will output help and exit without actually executing
      the test suites.
      Yoney committed
  14. 31 Oct, 2017 1 commit
  15. 30 Oct, 2017 1 commit
  16. 29 Oct, 2017 1 commit
  17. 23 Oct, 2017 4 commits
  18. 20 Oct, 2017 1 commit
    • cmake: use project-relative binary and source directories · 4da74c83
      Due to our split of CMake files into multiple modules, we had to replace
      some uses of the `${CMAKE_CURRENT_SOURCE_DIR}` and
      `${CMAKE_CURRENT_BINARY_DIR}` variables and replace them with
      `${CMAKE_SOURCE_DIR}` and `${CMAKE_BINARY_DIR}`. This enabled us to
      still be able to refer to top-level files when defining build
      instructions inside of a subdirectory.
      
      When replacing all variables, it was assumed that the absolute set of
      variables is always relative to the current project. But in fact, this
      is not the case, as these variables always point to the source and
      binary directory as given by the top-levl project. So the change
      actually broke the ability to include libgit2 directly as a subproject,
      as source files cannot be found anymore.
      
      Fix this by instead using project-specific source and binary directories
      with `${libgit2_SOURCE_DIR}` and `${libgit2_BINARY_DIR}`.
      Patrick Steinhardt committed
  19. 09 Oct, 2017 5 commits
    • config_file: implement "gitdir/i" conditional · f7d837c8
      Next to the "gitdir" conditional for including other configuration
      files, there's also a "gitdir/i" conditional. In contrast to the former
      one, path matching with "gitdir/i" is done case-insensitively. This
      commit implements the case-insensitive condition.
      Patrick Steinhardt committed
    • config_file: implement conditional "gitdir" includes · 071b6c06
      Upstream git.git has implemented the ability to include other
      configuration files based on conditions. Right now, this only includes
      the ability to include a file based on the gitdir-location of the
      repository the currently parsed configuration file belongs to. This
      commit implements handling these conditional includes for the
      case-sensitive "gitdir" condition.
      Patrick Steinhardt committed
    • config: pass repository when opening config files · 529e873c
      Our current configuration logic is completely oblivious of any
      repository, but only cares for actual file paths. Unfortunately, we are
      forced to break this assumption by the introduction of conditional
      includes, which are evaluated in the context of a repository. Right now,
      only one conditional exists with "gitdir:" -- it will only include the
      configuration if the current repository's git directory matches the
      value passed to "gitdir:".
      
      To support these conditionals, we have to break our API and make the
      repository available when opening a configuration file. This commit
      extends the `open` call of configuration backends to include another
      repository and adjusts existing code to have it available. This includes
      the user-visible functions `git_config_add_file_ondisk` and
      `git_config_add_backend`.
      Patrick Steinhardt committed
    • tests: checkout::tree: check that the status list catches mode changes · 09c15a7f
      While we verify that we have no mode changes after calling
      `git_checkout_tree`, we do not verify that the `p_chmod` calls actually
      resulted in a changed entry. While we should assume that this works due
      to separate tests for the status list, we should test for the change
      being listed to avoid programming errors in the test.
      Patrick Steinhardt committed
    • tests: checkout::tree: extract check for status entrycount · 880dfc50
      There are multiple locations where we have the same code to check
      whether the count of status list entries of a repository matches an
      expected number. Extract that into a common function.
      Patrick Steinhardt committed
  20. 07 Oct, 2017 1 commit
  21. 06 Oct, 2017 1 commit
    • refs: do not use peeled OID if peeling to a tag · b112b1e9
      If a reference stored in a packed-refs file does not directly point to a
      commit, tree or blob, the packed-refs file will also will include a
      fully-peeled OID pointing to the first underlying object of that type.
      If we try to peel a reference to an object, we will use that peeled OID
      to speed up resolving the object.
      
      As a reference for an annotated tag does not directly point to a commit,
      tree or blob but instead to the tag object, the packed-refs file will
      have an accomodating fully-peeled OID pointing to the object referenced
      by that tag. When we use the fully-peeled OID pointing to the referenced
      object when peeling, we obviously cannot peel that to the tag anymore.
      
      Fix this issue by not using the fully-peeled OID whenever we want to
      peel to a tag. Note that this does not include the case where we want to
      resolve to _any_ object type. Existing code may make use from the fact
      that we resolve those to commit objects instead of tag objects, even
      though that behaviour is inconsistent between packed and loose
      references. Furthermore, some tests of ours make the assumption that we
      in fact resolve those references to a commit.
      Patrick Steinhardt committed
  22. 20 Sep, 2017 2 commits
    • cmake: unify version check for target include directories · d8d2f21e
      There are two locations where we check whether CMake supports
      `TARGET_INCLUDE_DIRECTORIES`. While the first one uses `VERSION_LESS
      2.8.12`, the second one uses `VERSION_GREATER 2.8.11`, which are
      obviously equivalent to each other. It'd still be easier to grep for
      specific CMake versions being required for some features if both used
      the same conditional mentioning the actual target version required. So
      this commit refactors these conditions to make them equal.
      Patrick Steinhardt committed
    • cmake: distinguish libgit2 objects and sources · 1d9dd882
      Distinguish variables keeping track of our internal libgit2 sources and
      the final objects which shall be linked into the library. This will ease
      the transition to use object libraries for our bundled dependencies
      instead of linking them in.
      Patrick Steinhardt committed
  23. 01 Sep, 2017 1 commit
  24. 30 Aug, 2017 1 commit
    • tests: deterministically generate test suite definitions · 583e4141
      The script "generate.py" is used to parse all test source files for unit
      tests. These are then written into a "clar.suite" file, which can be
      included by the main test executable to make available all test suites
      and unit tests.
      
      Our current algorithm simply collects all test suites inside of a dict,
      iterates through its items and dumps them in a special format into the
      file. As the order is not guaranteed to be deterministic for Python
      dictionaries, this may result in arbitrarily ordered C structs. This
      obviously defeats the purpose of reproducible builds, where the same
      input should always result in the exact same output.
      
      Fix this issue by sorting the test suites by name previous to dumping
      them as structs. This enables reproducible builds for the libgit2_clar
      file.
      Patrick Steinhardt committed
  25. 25 Aug, 2017 2 commits