1. 12 Jul, 2020 3 commits
    • branch: determine whether a branch is checked out via refdb · ac5fbe31
      We currently determine whether a branch is checked out via
      `git_repository_foreach_head`. As this function reads references
      directly from the disk, it breaks our refdb abstraction in case the
      repository uses a different reference backend implementation than the
      filesystem-based one. So let's use `git_repository_foreach_worktree`
      instead -- while it's less efficient, it is at least correct in all
      corner cases.
      Patrick Steinhardt committed
    • refs: update HEAD references via refdb · 7216b048
      When renaming a reference, we need to iterate over every HEAD and
      potentially update it in case it is a symbolic reference pointing to the
      previous name of the renamed reference. Most importantly, this doesn't
      only include HEADs from the repo we're renaming the reference in, but we
      also need to iterate over HEADs from linked worktrees.
      
      In order to update the HEADs, we directly read them from the worktree's
      gitdir and thus assume that both repository and worktrees use the
      filesystem-based reference backend. But this breaks as soon as one got a
      repository with a different refdb and breaks our own abstractions. So
      let's instead update HEAD references via the refdb by first opening each
      worktree as a repository and then using the usual functions to read and
      update HEADs. This is a lot less efficient than the current code, but
      it's not like we can really help this: going via the refdb is mandatory.
      Patrick Steinhardt committed
    • repository: introduce new function to iterate over all worktrees · 2fcb4f28
      Given a Git repository, it's non-trivial to iterate over all worktrees
      that are associated with it, including the "main" repository. This
      commit adds a new internal function `git_repository_foreach_worktree`
      that does this for us.
      Patrick Steinhardt committed
  2. 23 Jun, 2020 1 commit
  3. 17 Jun, 2020 5 commits
  4. 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
  5. 13 Jun, 2020 1 commit
  6. 12 Jun, 2020 1 commit
  7. 11 Jun, 2020 1 commit
  8. 10 Jun, 2020 2 commits
  9. 09 Jun, 2020 5 commits
    • cmake: enable warnings for missing function declarations · 03c4f86c
      Over time, we have accumulated quite a lot of functions with missing
      prototypes, missing `static` keywords or which were completely unused.
      It's easy to miss these mistakes, but luckily GCC and Clang both have
      the `-Wmissing-declarations` warning. Enabling this will cause them to
      emit warnings for every not-static function that doesn't have a previous
      declaration. This is a very sane thing to enable, and with the preceding
      commits all these new warnings have been fixed.
      
      So let's always enable this warning so we won't introduce new instances
      of them.
      Patrick Steinhardt committed
    • refs: add missing function declaration · fd1f0940
      The function `git_reference__is_note` is not declared anywhere. Let's
      add the declaration to avoid having non-static functions without
      declaration.
      Patrick Steinhardt committed
    • tree-wide: do not compile deprecated functions with hard deprecation · c6184f0c
      When compiling libgit2 with -DDEPRECATE_HARD, we add a preprocessor
      definition `GIT_DEPRECATE_HARD` which causes the "git2/deprecated.h"
      header to be empty. As a result, no function declarations are made
      available to callers, but the implementations are still available to
      link against. This has the problem that function declarations also
      aren't visible to the implementations, meaning that the symbol's
      visibility will not be set up correctly. As a result, the resulting
      library may not expose those deprecated symbols at all on some platforms
      and thus cause linking errors.
      
      Fix the issue by conditionally compiling deprecated functions, only.
      While it becomes impossible to link against such a library in case one
      uses deprecated functions, distributors of libgit2 aren't expected to
      pass -DDEPRECATE_HARD anyway. Instead, users of libgit2 should manually
      define GIT_DEPRECATE_HARD to hide deprecated functions. Using "real"
      hard deprecation still makes sense in the context of CI to test we don't
      use deprecated symbols ourselves and in case a dependant uses libgit2 in
      a vendored way and knows it won't ever use any of the deprecated symbols
      anyway.
      Patrick Steinhardt committed
    • tree-wide: add missing header includes · 6e1efcd6
      We're missing some header includes leading to missing function
      prototypes. While we currently don't warn about these, we should have
      their respective headers included in order to detect the case where a
      function signature change results in an incompatibility.
      Patrick Steinhardt committed
    • tree-wide: mark local functions as static · a6c9e0b3
      We've accumulated quite some functions which are never used outside of
      their respective code unit, but which are lacking the `static` keyword.
      Add it to reduce their linkage scope and allow the compiler to optimize
      better.
      Patrick Steinhardt committed
  10. 08 Jun, 2020 6 commits
  11. 07 Jun, 2020 1 commit
  12. 06 Jun, 2020 12 commits