Skip to content

fix(dotgit): work with repos that use the new experimental git ref format - #1487

Open
vegerot wants to merge 1 commit into
meta:mainfrom
vegerot:fix-dotgit-reftable
Open

vegerot wants to merge 1 commit into
meta:mainfrom
vegerot:fix-dotgit-reftable

Conversation

@vegerot

@vegerot vegerot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

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 #1391

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.2 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01ECQd3Jewp71mGty3KKcGs9

### 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
@meta-cla meta-cla Bot added the CLA Signed label Nov 10, 2026
@vegerot vegerot changed the title fix(dotgit): open repos that use the reftable ref format fix(dotgit): work with repos that use the new experimental git ref format Nov 10, 2026
@meta-codesync

meta-codesync Bot commented Nov 10, 2026

Copy link
Copy Markdown

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🧨 dotgit mode fails on new repos with reftable format — unsupported extension name extensions.refstorage

1 participant