Repository navigation
Conversation
### Problem `sl` cannot open a Git repo that stores refs in the reftable format: ``` $ git init --ref-format=reftable repo && cd repo && sl status abort: ... opening git store: unsupported extension name extensions.refstorage; class=Repository (6) ``` Git marks such a repo with `extensions.refstorage = reftable`. `GitStore::open` opens the repo with libgit2 1.9, which rejects any extension it does not know. Only libgit2 2.0, currently a release candidate, accepts `refstorage`. Reading reftable refs already works since 5b7f339 ("gitcompat: support reftable references"). The failure happens before that code runs. `sl init --git` and `sl clone --git` fail the same way when reftable is Git's default, for example with `feature.experimental = true`. ### Solution Register `refstorage` with libgit2 (`git2::opts::set_extensions`) before opening the repo. This is enough because `GitStore` uses libgit2 only for the object database, which does not depend on the ref format. Refs go through `gitcompat`, which runs `git` for reftable repos. `extensions.refstorage` can also be `<format>://<path>`, which stores refs at a custom path. `gitcompat` cannot read those, and libgit2 no longer rejects them for us, so `GitStore::open` rejects them itself: ``` Git references stored at a custom path are not supported (extensions.refstorage = "reftable:///path/to/refs") ``` Before this change, that case failed with the generic `unsupported extension name` error. ### Test plan New `test-dotgit-reftable.t`: `sl log` reads a reftable repo, and `git log` shows a commit made by `sl commit`. Before this change it fails with the error above. **The test needs Git 2.45 or later**, the first version with the reftable backend (`git init --ref-format=reftable`). With an older Git the test fails; it does not skip. `make oss` on macOS with Git 2.56.0, then: * `run-tests.py --with-hg ../out/sl test-dotgit-*.t`: 12 ran, 0 failed, 1 skipped (`test-dotgit-gpg.t`) * By hand: `sl init --git` and `sl clone --git` work with reftable as Git's default. * By hand: a repo with `extensions.refstorage = reftable://<path>` shows the new error, and `git log` is unchanged afterwards. No test covers the custom path error. Closes meta#1391 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ECQd3Jewp71mGty3KKcGs9
|
This pull request has been imported. If you are a Meta employee, you can view this in D131048102. (Because this pull request was imported automatically, there will not be any future comments.) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
slcannot open a Git repo that stores refs in the reftable format:Git marks such a repo with
extensions.refstorage = reftable.GitStore::openopens the repo with libgit2 1.9, which rejects any extension it does not know. Only libgit2 2.0, currently a release candidate, acceptsrefstorage.Reading reftable refs already works since 5b7f339 ("gitcompat: support reftable references"). The failure happens before that code runs.
sl init --gitandsl clone --gitfail the same way when reftable is Git's default, for example withfeature.experimental = true.Solution
Register
refstoragewith libgit2 (git2::opts::set_extensions) before opening the repo. This is enough becauseGitStoreuses libgit2 only for the object database, which does not depend on the ref format. Refs go throughgitcompat, which runsgitfor reftable repos.extensions.refstoragecan also be<format>://<path>, which stores refs at a custom path.gitcompatcannot read those, and libgit2 no longer rejects them for us, soGitStore::openrejects them itself:Before this change, that case failed with the generic
unsupported extension nameerror.Test plan
New
test-dotgit-reftable.t:sl logreads a reftable repo, andgit logshows a commit made bysl commit. Before this change it fails with the error above.The test needs Git 2.45 or later, the first version with the reftable backend (
git init --ref-format=reftable). With an older Git the test fails; it does not skip.make osson macOS with Git 2.56.0, then:run-tests.py --with-hg ../out/sl test-dotgit-*.t: 12 ran, 0 failed, 1 skipped (test-dotgit-gpg.t)sl init --gitandsl clone --gitwork with reftable as Git's default.extensions.refstorage = reftable://<path>shows the new error, andgit logis unchanged afterwards.No test covers the custom path error.
Closes #1391
🤖 Generated with Claude Code
Co-Authored-By: Claude Fable 5.2 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01ECQd3Jewp71mGty3KKcGs9