Skip to content

reftable support for libgit2 #5352

Open

Description

@hanwen

See also #4981 (comment)

I have written a mostly complete implementation of reftable as a standalone library that depends only on zlib.

It is here: https://github.com/google/reftable (subdirectory c/ for the C code).

I have some alpha-quality code that integrates it into git-core, and am currently discussing how to proceed, both with the git-core team and the open-source lawyers at Google. I had intended this library to also be used in libgit2.

There are a couple of questions:

  • Do you want this in libgit2 as well (I think so, given the earlier comment)

  • How can we structure this? We could keep reftable as a standalone-separate library, or it can be integrated into some other project (eg. libgit2). If it is in libgit2, could patches move from libgit2 to git-core, license-wise? If we keep it as a separate library, do you see licensing problems with leaving the library under Apache2?

@mhagger , @ethomson

Activity

  1. ethomson commented on Jan 9, 2020

    @ethomson
    Member

    I do want this in libgit2 as well. 😁

    My gut suggests that this is a standalone library and libgit2 and git both pull it in... probably by us pulling it in to our deps folder...? This might be the easiest way to allow git and libgit2 to collaborate on it?

    But what I really want to avoid is it going off in three different directions - the original, the libgit2 version and the git version. It would be nice if we had buy in from git that they would also consume the upstream and contribute back changes.

    (Right now we're in a place where we have different xdiff implementations, which is sad.)

  2. hanwen commented on Jan 10, 2020

    @hanwen
    ContributorAuthor

    that is great to hear! I agree that there should be just one code base.

    I was thinking that a standalone library would be overkill, as it would basically only be used by libgit2 and git-core, but maybe it is the most practical mechanism to allow cooperation.

    Is libgit2 ok with linking to an Apache2 library?

  3. hanwen commented on Jan 10, 2020

    @hanwen
    ContributorAuthor

    For clarification, I think it is best to link the library statically into the either project, or even, to consume the library as a submodule (ie. compiling it directly into libgit2/cgit). I'd rather not have to deal with runtime .so versioning

  4. hanwen commented on Jan 10, 2020

    @hanwen
    ContributorAuthor

    IIUC, we can change license to be something else, but want to avoid dual licensing.

  5. hanwen commented on Jan 10, 2020

    @hanwen
    ContributorAuthor

    "probably by us pulling it in to our deps folder...?"

    yes, that sounds perfect.

  6. pks-t commented on Jan 10, 2020

    @pks-t
    Member

    For clarification, I think it is best to link the library statically into the either project, or even, to consume the library as a submodule (ie. compiling it directly into libgit2/cgit). I'd rather not have to deal with runtime .so versioning

    Fine with us, we're statically linking against all bundled dependencies anyway.

    Is libgit2 ok with linking to an Apache2 library?

    Unfortunately, no, as libgit2 uses GPLv2. Quoting the licenses page on gnu.org:

    Please note that this license is not compatible with GPL version 2, because it has some requirements that are not in that GPL version. These include certain patent termination and indemnification provisions. The patent termination provision is a good thing, which is why we recommend the Apache 2.0 license for substantial programs over other lax permissive licenses.

    Note that the same applies to the git project, as they're using GPLv2 as well.

  7. hanwen commented on Jan 20, 2020

    @hanwen
    ContributorAuthor
  8. pks-t commented on Jan 21, 2020

    @pks-t
    Member
  9. hanwen commented on Jan 22, 2020

    @hanwen
    ContributorAuthor

    I changed the license in google/reftable@4e1cc9b

    Can you have a look at the API to see if this works for you? It's over here:

    https://github.com/google/reftable/blob/master/c/reftable.h

    I wonder if I should prefix the type and function names with reftable_ to avoid namespace clashes.

    Also, I wrote this for posix. It may need some tweaking to use with Windows. It'd be great to get patches for that, as I don't actually have any windows machine.

  10. lorenzleutgeb commented on May 13, 2024

    @lorenzleutgeb

    Since reftables made it into Git 2.45, this might change the priority of adding support in libgit2?

  11. lorenzleutgeb commented on Sep 20, 2024

    @lorenzleutgeb

    See #5462

  12. groutoutlook commented on Sep 8, 2025

    @groutoutlook

    hi, have git2 get any traction on support for reftable yet? Newly clone repo is broken for extension.refstorage, even dotnet build is broken without git config --global --unset-all extensions.refstorage

    Additional Context

  13. pks-gitlab commented on Sep 8, 2025

    @pks-gitlab

    @groutoutlook There's a fully working backend in #7117. Only problem is that we're lacking reviewers, and because of that it cannot be merged. If you want to help moving it along you can do so by reviewing that pull request and its dependencies.

  14. rjorgenson commented on May 11, 2026

    @rjorgenson

    I see this PR was merged 5 days ago(🙌 ), is this going to part of the v2 release coming up or will there be another release prior to that sooner?

  15. simnalamburt commented on Jun 8, 2026

    @simnalamburt

    Context for visitors: PR #7117 was merged to main branch, but it was not included in the v1.9.3 or v1.9.4 releases.

  16. ofek commented on Jul 1, 2026

    @ofek

    The release notes for v1.9.0 indicate that the next feature release will likely be a major version bump that will introduce backward-incompatible changes. Since the note says that it's "expected" to be the last v1.x rather than something set in stone, would it be possible to have a v1.10.x so that folks can start using #7117 and other features?

    Alternatively, are there any remaining blockers for releasing v2.0.0? The expected breaking changes don't appear to be that disruptive, all things considered.

    cc @ethomson @carlosmn

  17. Freed-Wu commented on Jul 11, 2026

    @Freed-Wu
  18. simnalamburt commented on Jul 13, 2026

    @simnalamburt

    In fact, the libgit2 main branch (HEAD) is quite stable. Everything works well enough that you can just use the main branch without waiting for a new release. I've been using it more than a month and there was no issue. :)

    Reference: romkatv/gitstatus#455 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions