1. 04 Jun, 2017 1 commit
  2. 20 May, 2017 4 commits
  3. 19 May, 2017 4 commits
    • repository: make check if repo is a worktree more strict · 2696c5c3
      To determine if a repository is a worktree or not, we currently check
      for the existence of a "gitdir" file inside of the repository's gitdir.
      While this is sufficient for non-broken repositories, we have at least
      one case of a subtly broken repository where there exists a gitdir file
      inside of a gitmodule. This will cause us to misidentify the submodule
      as a worktree.
      
      While this is not really a fault of ours, we can do better here by
      observing that a repository can only ever be a worktree iff its common
      directory and dotgit directory are different. This allows us to make our
      check whether a repo is a worktree or not more strict by doing a simple
      string comparison of these two directories. This will also allow us to
      do the right thing in the above case of a broken repository, as for
      submodules these directories will be the same. At the same time, this
      allows us to skip the `stat` check for the "gitdir" file for most
      repositories.
      Patrick Steinhardt committed
    • repository: factor out worktree check · 9f9fd05f
      The check whether a repository is a worktree or not is currently done
      inside of `git_repository_open_ext`. As we want to extend this function
      later on, pull it out into its own function `repo_is_worktree` to ease
      working on it.
      Patrick Steinhardt committed
    • repository: improve parameter names for `find_repo` · 32841973
      The out-parameters of `find_repo` containing found paths of a repository
      are a tad confusing, as they are not as obvious as they could be. Rename
      them like following to ease reading the code:
      
      - `repo_path` -> `gitdir_path`
      - `parent_path` -> `workdir_path`
      - `link_path` -> `gitlink_path`
      - `common_path` -> `commondir_path`
      Patrick Steinhardt committed
    • repository: clear out-parameter instead of freeing it · 57121a23
      The `path` out-parameter of `find_repo` is being sanitized initially
      such that we do not try to append to existing content. The sanitization
      is done via `git_buf_free`, though, which forces us to needlessly
      reallocate the buffer later in the function. Fix this by using
      `git_buf_clear` instead.
      Patrick Steinhardt committed
  4. 17 May, 2017 1 commit
  5. 16 May, 2017 1 commit
  6. 15 May, 2017 5 commits
  7. 11 May, 2017 2 commits
  8. 05 May, 2017 1 commit
  9. 04 May, 2017 1 commit
  10. 03 May, 2017 1 commit
    • tests: repo: fix repo discovery tests on overlayfs · ffd264d9
      Debian and Ubuntu often use schroot to build their DEB packages in a
      controlled environment. Depending on how schroot is configured, our
      tests regarding repository discovery break due to not being able to find
      the repositories anymore. It turns out that these errors occur when the
      schroot is configured to use an overlayfs on the directory structures.
      
      The reason for this failure is that we usually refrain from discovering
      repositories across devices. But unfortunately, overlayfs does not have
      consistent device identifiers for all its files but will instead use the
      device number of the filesystem the file stems from. So whenever we
      cross boundaries between the upper and lower layer of the overlay, we
      will fail to properly detect the repository and bail out.
      
      This commit fixes the issue by enabling cross-device discovery in our
      tests. While it would be preferable to have this turned off, it probably
      won't do much harm anyway as we set up our tests in a temporary location
      outside of the parent repository.
      Patrick Steinhardt committed
  11. 02 May, 2017 4 commits
  12. 01 May, 2017 10 commits
  13. 29 Apr, 2017 2 commits
  14. 28 Apr, 2017 3 commits
    • odb: verify hashes in read_prefix_1 · e0973bc0
      While the function reading an object from the complete OID already
      verifies OIDs, we do not yet do so for reading objects from a partial
      OID. Do so when strict OID verification is enabled.
      Patrick Steinhardt committed
    • odb: improve error handling in read_prefix_1 · 14109620
      The read_prefix_1 function has several return statements springled
      throughout the code. As we have to free memory upon getting an error,
      the free code has to be repeated at every single retrun -- which it is
      not, so we have a memory leak here.
      
      Refactor the code to use the typical `goto out` pattern, which will free
      data when an error has occurred. While we're at it, we can also improve
      the error message thrown when multiple ambiguous prefixes are found. It
      will now include the colliding prefixes.
      Patrick Steinhardt committed
    • odb: add option to turn off hash verification · 35079f50
      Verifying hashsums of objects we are reading from the ODB may be costly
      as we have to perform an additional hashsum calculation on the object.
      Especially when reading large objects, the penalty can be as high as
      35%, as can be seen when executing the equivalent of `git cat-file` with
      and without verification enabled. To mitigate for this, we add a global
      option for libgit2 which enables the developer to turn off the
      verification, e.g. when he can be reasonably sure that the objects on
      disk won't be corrupted.
      Patrick Steinhardt committed