Skip to content

Ability to use git refs migrate --ref-format=reftable - #118

Merged
hannesa2 merged 2 commits into
masterfrom
ref-format-reftable
Oct 24, 2026
Merged

hannesa2 merged 2 commits into
masterfrom
ref-format-reftable

Conversation

@hannesa2

@hannesa2 hannesa2 commented Oct 22, 2026 •

Copy link
Copy Markdown

Summary

Bumps the vendored libgit2 submodule to the v2.0.0-rc.1 release candidate
tag and adjusts ObjectiveGit for the resulting libgit2 2.0 API changes, so
that repositories migrated with git refs migrate --ref-format=reftable can
be opened again.

v1.9.x doesn't recognize extensions.refstorage=reftable at all, so opening
such a repository failed with unsupported extension name extensions.refstorage. libgit2 only gained a native reftable refdb backend
after 1.9, first shipping in v2.0.0-rc.1, so the submodule is pinned there.

Note: v2.0.0-rc.1 is a release candidate, not a final libgit2 2.0
release. This PR exists to validate reftable support; it should be revisited
once libgit2 2.0.0 (or a later rc) is tagged.

Changes

  • External/libgit2: bumped to the v2.0.0-rc.1 tag.
  • ObjectiveGit/GTObject.h: GTObjectTypeOffsetDelta/GTObjectTypeRefDelta
    are now hardcoded to 6/7. libgit2 2.0 removed these from the public
    git_object_t enum (they're pack-internal delta types, never real ODB
    objects); the numeric values are stable per the git pack-format spec.
  • ObjectiveGit/GTOID.m: OIDByHashingData:type:error: now uses
    git_object_id_from_buffer instead of the deprecated git_odb_hash.
  • ObjectiveGit/GTRepository.h: GTRepositoryInitWithoutDotGit is now a
    hardcoded no-op (0) and marked deprecated. In libgit2 1.9.7 this was a
    real bit (GIT_REPOSITORY_INIT_NO_DOTGIT_DIR, 1u << 2) that stopped
    .git being appended to the init path; libgit2 2.0 dropped the flag
    entirely, and the same effect is now implied whenever workdir_path is set
    on the init options instead. Nothing in GitX or this repo uses this flag.
  • script/update_libgit2: added -DUSE_GSSAPI:BOOL=OFF to the CMake
    invocation. Without it, CMake on macOS auto-detects GSS.framework /
    system Kerberos and enables GSSAPI/Negotiate HTTP auth support in
    v2.0.0-rc.1, which requires linking GSS symbols that the Xcode project
    doesn't link, causing ld: Undefined symbols ... _gss_* at link time.
    Disabling GSSAPI avoids that dependency; GitX doesn't use Negotiate auth.

Known limitation

v2.0.0-rc.1 vendors libgit2's low-level deps/reftable library, but
upstream has not yet wired it into an actual refdb backend (no
refdb_reftable.c, extensions.refstorage not yet in the builtin extensions
allowlist). Opening a reftable-format repository therefore still fails today;
this is tracked upstream as libgit2/libgit2#5352 and will need a newer
libgit2 release once that lands.

@hannesa2
hannesa2 force-pushed the ref-format-reftable branch 3 times, most recently from 1f67996 to 1820260 Compare October 23, 2026 06:18
@hannesa2
hannesa2 requested a balanced review from Copilot October 23, 2026 06:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@hannesa2
hannesa2 force-pushed the ref-format-reftable branch 2 times, most recently from f238100 to 6f13ed7 Compare October 24, 2026 06:08
@hannesa2
hannesa2 requested a review from goneng October 24, 2026 06:10

@goneng goneng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, @hannesa2 .
I built it with the GitX PR on top and the full GitX suite passes.
The git_object_id_from_buffer switch in GTOID.m looks right (OID type defaults to SHA-1), and
having no git2/deprecated.h imports left is a nice outcome for libgit2#652.

A few "cosmetic" suggestions:

  • GTRepositoryInitWithoutDotGit = 0:
    The new comment says the flag "was already a deprecated no-op".
    In libgit2 1.9.7 it was a real bit, (1u << 2), that stopped .git being appended.
    In 2.0 it is #define ... 0 in deprecated.h, and the behavior is implied when workdir_path is set.
    Could you reword the comment?
    (A caller that used the flag without workdir_path now silently gets different behavior, so
    deprecating the enum member (or removing it) may be worth considering.
    Nothing in GitX or in this repo uses it.)
  • Commit order:
    The first commit uses git_object_id_from_buffer, which does not exist in libgit2 1.9.7,
    and the libgit2 bump comes second, so the first commit alone does not build.
    Swapping the order or squashing them keeps git bisect usable.
  • -DUSE_GSSAPI:BOOL=OFF in script/update_libgit2:
    this is needed, since rc.1 otherwise finds GSS.framework and enables Negotiate auth.
    I suggest saying so in the PR description, because it is not obvious from the diff.
  • Minor and optional:
    git_dataWithOid: and git_getOid:error: in NSData+Git.m use sizeof(git_oid), which
    now includes a type byte.
    I found no callers, so nothing breaks today.

Apart from these small issues, I think it is safe to merge.

v1.9.x does not recognize extensions.refstorage=reftable at all, so
opening a repository that has been migrated with
'git refs migrate --ref-format=reftable' failed with
'unsupported extension name extensions.refstorage' even though the
previous commit already adjusted GTOID/GTObject/GTRepository for the
newer libgit2 API and added the USE_GSSAPI=OFF build flag. libgit2
only gained a native reftable refdb backend after 1.9, first shipping
in the v2.0.0-rc.1 tag, so pin the submodule there instead.
@hannesa2
hannesa2 force-pushed the ref-format-reftable branch from 6f13ed7 to 7006360 Compare October 24, 2026 10:41
@hannesa2

Copy link
Copy Markdown
Author

I applied your suggestions @goneng

@hannesa2
hannesa2 requested a review from goneng October 24, 2026 10:43

@goneng goneng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@hannesa2
hannesa2 merged commit f982117 into master Oct 24, 2026
2 checks passed
@hannesa2
hannesa2 deleted the ref-format-reftable branch October 24, 2026 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants