From ee0972cac8f4d85924eb5ea1c517260bc9b7cdfb Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Sat, 12 Jul 2025 00:00:21 +0200 Subject: [PATCH] refdb: wire up "reftable" storage format Wire up the "reftable" storage format via the newly implemented reftable backend. --- include/git2/refdb.h | 3 ++- src/libgit2/refdb.c | 4 ++++ src/libgit2/refdb.h | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/git2/refdb.h b/include/git2/refdb.h index a896bdd07..dc8f4e58f 100644 --- a/include/git2/refdb.h +++ b/include/git2/refdb.h @@ -23,7 +23,8 @@ GIT_BEGIN_DECL /** The type of the refdb as determined by "extensions.refStorage". */ typedef enum { - GIT_REFDB_FILES = 1 /**< Files backend using loose and packed refs. */ + GIT_REFDB_FILES = 1, /**< Files backend using loose and packed refs. */ + GIT_REFDB_REFTABLE = 2 /**< Reftable backend. */ } git_refdb_t; /** diff --git a/src/libgit2/refdb.c b/src/libgit2/refdb.c index facc64364..3457a8797 100644 --- a/src/libgit2/refdb.c +++ b/src/libgit2/refdb.c @@ -56,6 +56,10 @@ int git_refdb_open(git_refdb **out, git_repository *repo) if ((error = git_refdb_backend_fs(&backend, repo)) < 0) goto out; break; + case GIT_REFDB_REFTABLE: + if ((error = git_refdb_backend_reftable(&backend, repo)) < 0) + goto out; + break; default: git_error_set(GIT_ERROR_REFERENCE, "unknown reference storage format"); error = GIT_EINVALID; diff --git a/src/libgit2/refdb.h b/src/libgit2/refdb.h index 6a5ae3299..a0151e774 100644 --- a/src/libgit2/refdb.h +++ b/src/libgit2/refdb.h @@ -137,6 +137,8 @@ GIT_INLINE(const char *) git_refdb_type_name(git_refdb_t type) switch (type) { case GIT_REFDB_FILES: return "files"; + case GIT_REFDB_REFTABLE: + return "reftable"; default: return "unknown"; } @@ -146,6 +148,8 @@ GIT_INLINE(git_refdb_t) git_refdb_type_fromstr(const char *name) { if (strcmp(name, "files") == 0) return GIT_REFDB_FILES; + if (strcmp(name, "reftable") == 0) + return GIT_REFDB_REFTABLE; return 0; }